Skip to main content

linalg.gram_pca

linalg.gram_pca(gram, tol=1e-07, return_us=False)

Principal component analysis (PCA) based on the Gram matrix.

Parameters

Name Type Description Default
gram ndarray of shape (N, N) or (N*(N+1)//2,) The Gram matrix, either as a full (N, N) array or as the upper triangle in a 1-D array of length N*(N+1)//2 (as returned by :func:gram with full=False). required
tol float Tolerance for the eigenvalues to be considered positive. 1e-7
return_us bool If True, also return the eigenvectors U and sqrt-eigenvalues s in addition to the PCs. False

Returns

Name Type Description
PCs ndarray of shape (N, N - 1) The principal components (PCs) derived from the Gram matrix. Only returned when return_us=False.
U ndarray of shape (N, N - 1) Eigenvectors in descending eigenvalue order. Only returned when return_us=True.
s ndarray of shape (N - 1,) Square roots of eigenvalues in descending order. Only returned when return_us=True.