FastRandPCA.eig_svd
— Functioneig_svd(A, [k]; [kwargs...])
Perform singular value decomposition of a matrix A
by estimating svd(A' * A)
. If k
is provided, Krylov iterative solver is used to return only k
largest singular values and corresponding singular vectors.
Designed to work with sparse matrices. Keyword arguments are forwarded to KrylovKit.svdsolve
.
Examples
using SparseArrays
eig_svd(sprand(100, 100, 0.2), 10)
FastRandPCA.pca
— Methodpca(A, k; [q=10], [exact_svd=false], [s=5])
Perform fast randomized PCA of a matrix A
to return k
first components.
Designed to work with sparse matrices.
Keyword arguments
exact_svd
- iftrue
, use exact SVD on random projections, otherwise useeig_svd
approximation. Setting it totrue
would improve precision of the algorithm on small eigenvalues, but would drastically decrease performance on large matrices (>1M rows).q
is the number of pass overA
,q
should larger than 1 andq
times pass eqauls to(q-2)/2
times power iterations
is the excess dimension for the random matrix. This parameter is not supposed to be changed normally.
Examples
using SparseArrays
pca(sprand(100, 100, 0.2), 10; q=3)