-
-
Notifications
You must be signed in to change notification settings - Fork 261
utils.svd_flip breaks on rectangular matrix #732
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
Comments
I'm not sure, but it seems that scikit-learn has similar behavior In [27]: u, s, v = np.linalg.svd(x.compute())
In [28]: u, v = sklearn.utils.extmath.svd_flip(u, v)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-28-ffeacd5d685b> in <module>
----> 1 u, v = sklearn.utils.extmath.svd_flip(u, v)
~/Envs/dask-dev/lib/python3.8/site-packages/sklearn/utils/extmath.py in svd_flip(u, v, u_based_decision)
533 signs = np.sign(u[max_abs_cols, range(u.shape[1])])
534 u *= signs
--> 535 v *= signs[:, np.newaxis]
536 else:
537 # rows of v, columns of u
ValueError: operands could not be broadcast together with shapes (1000,1000) (100,1) (1000,1000) |
Interesting, thanks @TomAugspurger. It looks to me like the issue is that I'll make or find an issue in dask since this should be a precursor to supporting #731 well. EDIT Looks like that's been in limbo for a while: dask/dask#3576 |
This isn't technically fixed since I left the existing sklearn-like svd_flip function alone for compatibility with older dask-ml/dask versions, but the real issue underlying this was addressed in dask/dask#6616. |
Is there a fundamental reason that this shouldn't work?
Environment:
The text was updated successfully, but these errors were encountered: