Skip to content

FIX: spectral_embedding.py initial eigenvector approximations for LOBPCG and AMG solvers should be randn not rand #21565

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

Merged
merged 5 commits into from
Dec 14, 2021

Conversation

lobpcg
Copy link
Contributor

@lobpcg lobpcg commented Nov 5, 2021

rand -> randn for LOBPCG and AMG eigensolvers

Reference Issues/PRs

Fixes #21555. See also #21534

rand -> randn for LOBPCG and AMG eigensolvers
@lobpcg lobpcg changed the title spectral_embedding.py initial eigenvector approximations for LOBPCG and AMG solvers should be randn not rand FIX: spectral_embedding.py initial eigenvector approximations for LOBPCG and AMG solvers should be randn not rand Nov 5, 2021
@ogrisel
Copy link
Member

ogrisel commented Nov 5, 2021

Could you please add a non-regression test with a toy dataset where the uniform sampling would lead to bad results while the gaussian is good?

@lobpcg
Copy link
Contributor Author

lobpcg commented Nov 5, 2021

Could you please add a non-regression test with a toy dataset where the uniform sampling would lead to bad results while the gaussian is good?

@ogrisel It's not trivial since it's random. It would require a fixed seed and would be platform-dependent, as most effects of numerical instability are.

It's a common understanding that randn should be used here, not rand; see my notes in #21555

In the previous PR we were going just to merge it. Can we do it?

@lobpcg
Copy link
Contributor Author

lobpcg commented Nov 19, 2021

@ogrisel could you please merge this trivial change?

@lobpcg
Copy link
Contributor Author

lobpcg commented Dec 3, 2021

@ogrisel or anyone else - could we please just merge this trivial change?

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is in the original paper, then I think we can considered this PR a bug fix. Can you point to the section in the paper that specifies the initial distribution? (I am unable to find it)

added 2 changed models as requested
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise this looks good to me. I left some comments about the "Change Model" section.

accepted proposed editing
@lobpcg
Copy link
Contributor Author

lobpcg commented Dec 4, 2021

@thomasjpfan - all fixed, thanks again for your help! Ready to merge?

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lobpcg
Copy link
Contributor Author

lobpcg commented Dec 5, 2021

Ready to merge, I suppose.

@lobpcg
Copy link
Contributor Author

lobpcg commented Dec 8, 2021

The corresponding change in lobpcg documentation has been merged in scipy/scipy#15154

This PR is ready to merge IMHO

@thomasjpfan
Copy link
Member

Since this PR could result in a model change, I think this PR requires a second review. Maybe @ogrisel ?

@lobpcg
Copy link
Contributor Author

lobpcg commented Dec 14, 2021

@ogrisel or anyone else - could you please review and merge this trivial change, while there is no conflict yet?

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for the slow response time.

@ogrisel ogrisel merged commit 08e7b7c into scikit-learn:main Dec 14, 2021
@lobpcg lobpcg deleted the patch-1 branch December 14, 2021 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spectral_embedding.py initial eigenvector approximations for LOBPCG and AMG solvers should be randn not rand
3 participants