Skip to contents

The loadings of a linear decomposition: the weight of each feature on each component.

Usage

get_loadings(decom)

Arguments

decom

Decomposition object.

Value

Numeric matrix, features by components, or NULL when the algorithm has no loadings.

Details

Loadings are defined for algorithms whose linear trait is TRUE; see decomposition_traits. The loadings matrix L is the one through which the components map back to the data, transformed %*% t(L), in the space the backend fits in:

PCA

The rotation, whose columns are the principal axes.

ICA

The transposed mixing matrix.

NMF

The basis matrix, non-negative.

Rows are named by the features the decomposition was fitted on and columns by its components, as in decom@transformed.

Author

EDG

Examples

iris_pca <- decomp(exc(iris, "Species"), algorithm = "PCA", verbosity = 0L)
get_loadings(iris_pca)
#>                     PC1         PC2        PC3
#> Sepal.Length  0.5210659 -0.37741762  0.7195664
#> Sepal.Width  -0.2693474 -0.92329566 -0.2443818
#> Petal.Length  0.5804131 -0.02449161 -0.1421264
#> Petal.Width   0.5648565 -0.06694199 -0.6342727