-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add non-negative least squares (NNLS) solver. #1155
Conversation
@rdyro How does this look? |
a503ed5
to
fe9fc6b
Compare
@carlosgmartin This looks great, I left one comment! |
@rdyro Where is this comment? |
Oops, should be up now! |
e654baf
to
e5b6d02
Compare
If speed is a consideration, perhaps we should use the I'd be curious if we could introduce a once-factorized cholesky version of this algorithm where we repeatedly apply cho_solve to a masked L or U factor of A^T A? |
@rdyro Edited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
I ran the tests internally and I can't pass the tolerance checks for this algorithm for larger dimensions (e.g., |
Possibly related: |
NaNs propagate so we'd see NaNs in the output, but the algorithm seems to not be converging instead. |
True. I also tried the The issue might be that the arithmetic operations of the algorithm accumulate numerical error, and thus the inequality comparisons (which are discontinuous) yield incorrect results. I'm taking a closer look. |
Due to the above difficulties, I switched to the fast projected gradient (FPG) algorithm of Polyak 2015. A clear presentation of the algorithm can be found here. It has some advantages described in the paper's introduction, including not solving a linear system on each iteration (only doing matrix-vector multiplications instead). |
9369da3
to
1fe7954
Compare
Nice! Maybe we can explore also adding an ADMM version in a future PR https://stanford.edu/class/ee364b/lectures/admm_slides.pdf since it's also promising a |
bcd3972
to
257c8ce
Compare
@rdyro Done. |
c99ad6a
to
fa9b5ed
Compare
Nice, this PR looks really good! Thank you! |
35e80c9
to
5493d58
Compare
@rdyro Made some minor changes to handle zero matrices without producing nans. |
Fixes #1152.