vampire.amath.pca#
- vampire.amath.pca(A, method=None)[source]#
Principal component analysis of matrix A.
Returns loadings, principal components, and explained variance.
- Parameters:
- Andarray
Matrix with shape (m, n), where n features are in columns, and m measurements are in rows.
- methodNone or str, optional
Algorithm used to compute PCA:
NoneIf m >= n, use eigen-decomposition algorithm.
If m < n, use singular value decomposition algorithm.
'eig'Eigen-decomposition algorithm.
'svd'Singular value decomposition algorithm.
- Returns:
- Vndarray
Loadings, weights, principal directions, principal axes, eigenvector of covariance matrix of mean-subtracted A, with shape (n, n).
- Tndarray
PC score, principal components, coordinates of mean-subtracted A in its principal directions, with shape (m, n).
- dndarray
Explained variance, eigenvalues of covariance matrix of mean-subtracted A, with size n.
See also
_pca_eigImplementation of eigen-decomposition algorithm.
_pca_svdImplementation of singular value decomposition algorithm.
sklearn.decomposition.PCAPackaged implementation.