Skip to content

new feature: add LOBPCG solver to Truncated PCA #12080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lobpcg opened this issue Sep 14, 2018 · 3 comments
Closed

new feature: add LOBPCG solver to Truncated PCA #12080

lobpcg opened this issue Sep 14, 2018 · 3 comments

Comments

@lobpcg
Copy link
Contributor

lobpcg commented Sep 14, 2018

Description

The code https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/decomposition/truncated_svd.py currently supports only

algorithm : string, default = "randomized"
SVD solver to use. Either "arpack" for the ARPACK wrapper in SciPy
(scipy.sparse.linalg.svds), or "randomized" for the randomized
algorithm due to Halko (2009).

while LOBPCG https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.lobpcg.html is already used in http://scikit-learn.org/stable/modules/generated/sklearn.manifold.SpectralEmbedding.html and http://scikit-learn.org/stable/modules/generated/sklearn.cluster.spectral_clustering.html

lobpcg_svd solver has been added in #12079

LOBPCG solver added to Truncated PCA in
https://github.com/lobpcg/scikit-learn/commit/ec61eef358cc8b9b6553cdeedd6b809246e9c716

Steps/Code to Reproduce

from sklearn.decomposition import TruncatedSVD
from sklearn.random_projection import sparse_random_matrix
X = sparse_random_matrix(100, 100, density=0.01, random_state=42)
svd = TruncatedSVD(n_components=5, n_iter=7, random_state=42)
svd.fit(X)
print(svd.explained_variance_ratio_)
print(svd.explained_variance_ratio_.sum())
print(svd.singular_values_)
svd = TruncatedSVD(algorithm='lobpcg', n_components=5, n_iter=7, random_state=42)
svd.fit(X)
print(svd.explained_variance_ratio_)
print(svd.explained_variance_ratio_.sum())
print(svd.singular_values_)

Expected Results

LOBPCG is expected to outperform both ARPACK and "randomized" solvers for Truncated PCA for large problems, e.g., see comments at https://www.mathworks.com/matlabcentral/fileexchange/48-lobpcg-m

Actual Results

Not supported

Versions

All

@aishgrt1
Copy link
Contributor

aishgrt1 commented Nov 1, 2018

Does this issue require any work? @lobpcg

@lobpcg
Copy link
Contributor Author

lobpcg commented Nov 1, 2018

@aishgrt1 All the coding for this issue, including comprehensive internal testing, is already done in PR #12319. Could you please have a look at PR #12319 and comment there? I would love to have this finished while I may still remember the details.

@lobpcg
Copy link
Contributor Author

lobpcg commented May 19, 2024

Since #12319 has been closed as abandoned, I am closing this issue as well as obsolete.

@lobpcg lobpcg closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants