Skip to content

Fix svd flip #595

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 8 commits into from
Dec 30, 2019
Merged

Fix svd flip #595

merged 8 commits into from
Dec 30, 2019

Conversation

fujiisoup
Copy link
Contributor

cc @demaheim
This adds a workaround for #592

I'm not sure why but for some reason, the array becomes sometimes read-only and cannot do the inplace multiplication. Large PCA fails because of this issue.
It may not be a perfect fix but it works for large arrays > 1TB.

Please let me know if anyone has better idea to fix this.

Copy link
Member

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Can you add a test that's failing on master? You may be able to construct a readonly array manually, and call svd_flip on that.

dask_ml/utils.py Outdated
@@ -23,8 +23,37 @@
logger = logging.getLogger()


def svd_flip_with_copy(u, v, u_based_decision=True):
Copy link
Member

Choose a reason for hiding this comment

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

Rather than duplicating the entire implementation, can you copy the inputs and set them to not be readonly?

@fujiisoup
Copy link
Contributor Author

Thank you, @TomAugspurger, for the reply.

Could you instruct me how to construct a read only dask array?
I'll add a test for this case.

@TomAugspurger
Copy link
Member

TomAugspurger commented Dec 30, 2019 via email

@fujiisoup
Copy link
Contributor Author

Ok. Then probably I can do this.
Will update in a few days.

@fujiisoup
Copy link
Contributor Author

Added a test.

@mrocklin
Copy link
Member

I like that when @fujiisoup says "days" he actually means "hours" :)

@TomAugspurger
Copy link
Member

I like that when @fujiisoup says "days" he actually means "hours" :)

:)

Thanks! These changes look perfect. The failure against scikit-learn master looks unrelated.

@TomAugspurger TomAugspurger merged commit f9c9fff into dask:master Dec 30, 2019
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

Successfully merging this pull request may close these issues.

4 participants