spectrochempy.SVD¶
- class SVD(**kwargs)[source]¶
Performs a Singular Value Decomposition of a dataset.
The SVD is commonly written as \(X = U \Sigma V^{T}\).
This class has the attributes : U, s = diag(S) and VT=V \(^T\).
If the dataset contains masked values, the corresponding ranges are ignored in the calculation.
- Parameters
dataset (|NDDataset| object) – The input dataset has shape (M, N). M is the number of observations (for examples a series of IR spectra) while N is the number of features (for example the wavenumbers measured in each IR spectrum).
full_matrices (bool, optional, default=False.) – If False , U and VT have the shapes (M, k) and (k, N), respectively, where k = min(M, N). Otherwise the shapes will be (M, M) and (N, N), respectively.
compute_uv (bool, optional, default: True.) – Whether or not to compute U and VT in addition to s.
Examples
>>> dataset = scp.read('irdata/nh4y-activation.spg') >>> svd = scp.SVD(dataset) >>> print(svd.ev.data) [1.185e+04 634 ... 0.001089 0.000975] >>> print(svd.ev_cum.data) [ 94.54 99.6 ... 100 100] >>> print(svd.ev_ratio.data) [ 94.54 5.059 ... 8.687e-06 7.779e-06]
Attributes
Explained variance (
NDDataset
).Cumulative Explained Variance (
NDDataset
).Explained Variance per singular values
NDDataset
).Singular values (
NDDataset
).