Fix svd sign indeterminacy#216
Conversation
|
Great feature that's been on the backlog for a while, thanks @merajhashemi and @aarmey! Currently this is NumPy specific though and not all backends support array_function so this won't work in all cases. Shall we move it inside the backend class and replace the |
d45beab to
2aa9834
Compare
|
Hi @merajhashemi -- are you still working on this? |
Codecov Report
@@ Coverage Diff @@
## main #216 +/- ##
==========================================
- Coverage 87.08% 86.88% -0.21%
==========================================
Files 89 89
Lines 4446 4446
==========================================
- Hits 3872 3863 -9
- Misses 574 583 +9
Continue to review full report at Codecov.
|
JeanKossaifi
left a comment
There was a problem hiding this comment.
I left a comment in the code for the NumPy conversion, otherwise, looks good to me, thanks @merajhashemi!
|
Thanks @merajhashemi - it would be good to have a small unit-test. Wondering whether it would make sense to unify with |
|
I see how they address similar needs, but I don't see a way to unify this with |
|
Unless you want to have a weird, general sign-flip function, I would also keep these separated? But maybe I am simply not understanding what you have in mind @JeanKossaifi |
|
Was just a thought as SVD can be seen as a 2D CP with weights = diag(S) and factors = [U, V], so it would be possible to resolve the sign ambiguity for all cases. But indeed the way it's done is different enough that a unified function would probably be awkward. Might be best leave the two separate indeed. |
JeanKossaifi
left a comment
There was a problem hiding this comment.
Looks good to me, just missing a small unit-test and I think it's ready to merge.
|
If this is just missing a test, I'm happy to write one as part of #227, since that will likely require some refactoring of the tests as well. |
|
Awesome, thanks @aarmey, in that case I'll go ahead and merge! |
This pr builds on @aarmey work in #174 and resolves #74.