Skip to content
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

[ENH] Get reproducible results with PCGA (set the initial vector used by scipy.sparse.linalg.eigsh ...) #18

Open
antoinecollet5 opened this issue Dec 4, 2022 · 3 comments

Comments

@antoinecollet5
Copy link
Collaborator

Up to now, when running pyPCGA twice or more with the same parameters, the results are slightly different each time.

This is what I attribute to the covariance matrix low-rank approximation relying on scipy.sparse.linalg.eigsh beauce the initial vector v0 is not provided and consequently chosen randomly.

The solution would be to let the possibility for the user set a seed (aka random_state) to generate a reproducible v0.

See: https://stackoverflow.com/a/52403508

@jonghyunharrylee
Copy link
Owner

Thank you Antoine and you are right that low-rank approx will not give users unique vectors. I guess I implemented it with oversampling parameters (let's say the number of eigenvectors computed to k + p where p is an oversampling parameter so that later we keep only "k" eigenmodes - this technique commonly used in randomized low-rank approximation) so that users expect less variability in results but not very sure. User-specified random seed would be a great option for reproducible results. I will take a look at it and will merge your PR. Happy holidays!

Best,
Harry

@antoinecollet5
Copy link
Collaborator Author

Hi Harry,

Happy new year and best wishes for 2023.

I just corrected a last bug in the changes I've made this morning. I tested and everything seems to work fine now.

Cheers
Antoine

@antoinecollet5
Copy link
Collaborator Author

Hi @jonghyunharrylee,

Any chance you will have time to look at it ?

Best regards

Antoine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants