Skip to contents

Derived from decomposition_traits and the metric registry: a metric applies to an algorithm when every trait it requires is TRUE for that algorithm.

Usage

applicable_metrics(algorithm = NULL)

Arguments

algorithm

Optional Character: Name of a decomposition algorithm, matched case-insensitively. NULL returns the full derived matrix.

Value

data.frame. With algorithm, the registry rows that apply to it: one row per metric, with its group, requirements, whether it needs new data, direction and range. With NULL, one row per metric and one logical column per algorithm.

Details

Nothing here is maintained per algorithm. reconstruction_rmse requires invertible, so it is defined for PCA, ICA and NMF and undefined for tSNE, UMAP and Isomap; max_abs_component_correlation requires nothing, so it is defined everywhere. An algorithm added to decom_algorithms with a correct traits row inherits the right metric set without any edit to the metrics code.

Author

EDG

Examples

# Every metric, and which algorithms support it
applicable_metrics()
#>                                name Autoencoder  ICA Isomap   MDS  NMF  PCA
#> 1          explained_variance_ratio        TRUE TRUE  FALSE FALSE TRUE TRUE
#> 2     relative_reconstruction_error        TRUE TRUE  FALSE FALSE TRUE TRUE
#> 3               reconstruction_rmse        TRUE TRUE  FALSE FALSE TRUE TRUE
#> 4     max_abs_component_correlation        TRUE TRUE   TRUE  TRUE TRUE TRUE
#> 5          effective_dimensionality        TRUE TRUE   TRUE  TRUE TRUE TRUE
#> 6      oos_explained_variance_ratio        TRUE TRUE  FALSE FALSE TRUE TRUE
#> 7 oos_relative_reconstruction_error        TRUE TRUE  FALSE FALSE TRUE TRUE
#> 8                reconstruction_gap        TRUE TRUE  FALSE FALSE TRUE TRUE
#>    PCoA  tSNE  UMAP VariationalAutoencoder
#> 1 FALSE FALSE FALSE                   TRUE
#> 2 FALSE FALSE FALSE                   TRUE
#> 3 FALSE FALSE FALSE                   TRUE
#> 4  TRUE  TRUE  TRUE                   TRUE
#> 5  TRUE  TRUE  TRUE                   TRUE
#> 6 FALSE FALSE FALSE                   TRUE
#> 7 FALSE FALSE FALSE                   TRUE
#> 8 FALSE FALSE FALSE                   TRUE
# What can be computed for a UMAP embedding, which does not invert
applicable_metrics("UMAP")
#>                            name      group requires needs_new_data
#> 4 max_abs_component_correlation components                   FALSE
#> 5      effective_dimensionality components                   FALSE
#>   higher_is_better  range
#> 4            FALSE [0, 1]
#> 5               NA [1, k]