hyperspy_ml_algorithms.RPCAGoDec#
- class hyperspy_ml_algorithms.RPCAGoDec(rank=5, lambda1=None, power=0, tol=0.001, max_iter=100, random_state=None)#
Bases:
objectRobust PCA via the GoDec algorithm (batch).
Decomposes a data matrix into low-rank and sparse components using bilateral random projections. This is a batch method — it processes the entire dataset at once and is best suited for data that fit in memory.
The algorithm is based on [Zhou2011].
- Parameters:
- rankint, default 5
Target rank of the low-rank approximation.
- lambda1float or None, default None
Threshold for soft-thresholding the sparse error. If None, defaults to
1 / sqrt(n_features).- powerint, default 0
Number of power iterations used during randomised initialisation.
- tolfloat, default 1e-3
Convergence tolerance on the Frobenius norm of the residual.
- max_iterint, default 100
Maximum number of iterations.
- random_stateNone, int, or numpy.random.RandomState, default None
Random seed or RandomState for reproducible initialisation.
- Attributes:
components_ndarray of shape (rank, n_features)Right singular vectors, shape
(rank, n_features).low_rank_ndarray of shape (n_samples, n_features)Low-rank reconstruction, shape
(n_samples, n_features).sparse_ndarray of shape (n_samples, n_features)Sparse error matrix, shape
(n_samples, n_features).singular_values_ndarray of shape (rank,)Singular values from the final SVD, shape
(rank,).
References
[Zhou2011]Tianyi Zhou and Dacheng Tao, “GoDec: Randomized Low-rank & Sparse Matrix Decomposition in Noisy Case”, ICML-11, (2011), pp. 33–40.
- __init__(rank=5, lambda1=None, power=0, tol=0.001, max_iter=100, random_state=None)#
Methods
__init__([rank, lambda1, power, tol, ...])fit(X[, y])Fit the GoDec RPCA model to X.
fit_transform(X[, y])Fit the model and return the low-rank reconstruction.
transform(X)Project X onto the learned components.
Attributes
components_Right singular vectors, shape
(rank, n_features).low_rank_Low-rank reconstruction, shape
(n_samples, n_features).singular_values_Singular values from the final SVD, shape
(rank,).sparse_Sparse error matrix, shape
(n_samples, n_features).