-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
MNT use scipy.sparse.csgraph.shortest_path
in Isomap
#20531
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
I assume that the remaining error is raised because we don't make any |
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.
LGTM
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.
Thanks for continuing that PR @TomDLT !
A few comments below, but generally LGTM.
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Thanks for the reviews. Now, instead of copying code from agglomerative clustering into isomap, both estimators use the same new private function |
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.
Great, thanks @TomDLT !
MNT use `scipy.sparse.csgraph.shortest_path` in Isomap (scikit-learn#20531)
…20531) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Is there a particular reason why connecting connected components is prohibited when |
With |
In the case where |
Thanks for insisting, you are right. There are two possibilities with
|
Takes over #14557
Fixes #14010 #8352
Closes #14557
From original pull-request:
As mentioned in the discussion in #14557, this pull-request introduces an issue with Isomap, since our own version of the graph shortest path would (wrongly) change infinite values into zeros. Infinite values can happen when there is more than one connected component in the neighbors graph. Changing to scipy's function does not change infinite values into zeros, so we could add this step back after calling scipy, but this step is wrong in the first place.
Here, I propose to raises an error instead. The question about how to best add magic to Isomap to avoid raising an error is a separate issue that should not block this PR.edit: I actually added some magic to connect disconnected components on the neighbors graph, to avoid raising errors.