Skip to main content

Module decomposition

Module decomposition 

Source
Expand description

Decomposition and embedding algorithms and their shared linear algebra.

Each concrete algorithm lives in its own submodule (pca, factor_analysis, ica, tsne, umap, lle) and is re-exported here so callers name decomposition::<algo> without the submodule path. This module owns the dense linear-algebra primitives the family shares — mean-centering, the covariance matrix, a symmetric-eigenvalue Jacobi solver, and a reconstruction-error measure — operating on row-major f64 buffers.

Components and embedding axes are defined only up to sign (and, for ICA and spectral methods, up to ordering), so the equivalence suite compares the sign/order-invariant quantities — explained variance, reconstruction error, and trustworthiness — rather than raw component values.

Structs§

FactorResult
Outcome of a factor-analysis fit.
IcaResult
Outcome of a FastICA fit.
PcaResult
Outcome of a PCA fit.

Functions§

at
Reads entry (i, j) from a row-major n×n buffer (0.0 if out of range).
column_means
Computes the per-feature mean (centroid) of a row-major data matrix.
count_to_f64
Widens a usize count to f64 without an as cast.
covariance
Computes the dim×dim sample covariance matrix of centered (already mean-centered) using the unbiased n − 1 denominator, matching scikit-learn.
descending_order
Returns the eigenvalue indices in descending order of eigenvalue.
factor_analysis
Fits a k-factor model to data by SVD-based EM.
fast_ica
Separates the linear mixture mixed into n_components independent sources.
identity
Builds the n×n identity matrix in a row-major buffer.
jacobi_eigen
Computes the eigenvalues and eigenvectors of a symmetric n×n matrix by the cyclic Jacobi rotation method.
lle
Embeds data into n_components dimensions by locally linear embedding.
mean_center
Mean-centers data, returning the centered matrix and the column means.
pca
Fits PCA to data, returning the top n_components principal components.
put
Writes entry (i, j) into a row-major n×n buffer (no-op if out of range).
reconstruction_error
Computes the mean squared reconstruction error between two equal-shaped matrices.
symmetric_inverse
Inverts a small symmetric positive-definite n×n matrix via its eigen- decomposition: A⁻¹ = V diag(1/λ) Vᵀ.
tsne
Embeds data into n_components dimensions by t-SNE.
umap
Embeds data into n_components dimensions by a UMAP-style layout.