-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Issue 1453: MDS fall back to SVD when possible #4485
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
Conversation
|
|
|
- check_arrays was deprecated. Changed to check_array - eigenvalue is now done using scipy.sparse.linalg, thus allowing to retreive only the k largest eigenvalues and vectors - uses sklearn.metrics.euclidean_distances when possible
@GaelVaroquaux @ogrisel I think this is ready. |
@@ -280,6 +320,10 @@ class MDS(BaseEstimator): | |||
compute metric or nonmetric SMACOF (Scaling by Majorizing a | |||
Complicated Function) algorithm | |||
|
|||
method: string, optional, default: smacof |
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.
We may want to switch the default to svd: it solves the exact problem, and should be much faster.
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.
I agree. Can you do a quick benchmark?
@@ -106,7 +107,9 @@ def _smacof_single(similarities, metric=True, n_components=2, init=None, | |||
(disparities ** 2).sum()) | |||
|
|||
# Compute stress | |||
stress = ((dis.ravel() - disparities.ravel()) ** 2).sum() / 2 | |||
stress = (euclidean_distances( |
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.
there is a squared
parameter to euclidean_distances
.
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.
Why did you change that, by the way?
Hello, I'm sort of picking up the various threads of this MDS problem extending back into the years... so apologies for the many comments everywhere. Is there any plan of merging this so that I can add a transform method to the SVD version, which is amenable to it? If you merge it I will be able to change #6222 in accordance to this rather than re-engineering with an extensible option. Edit: the eigen-decomposition could also be using linalg.eigsh since the matrix will be PSD and symmetric. |
@NelleV given your recent activity, do you want to pick up this one? |
moving to 0.21 |
Would be nice if someone could pick this up. |
removing from the milestone. |
I am closing this PR, because it is superseded by #22330. Thank you for working on this PR. |
This is a follow up on PR #3141.
I've fixed most of @ogrisel's comment.