-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
[MRG] DOCATHON : LLE and Isomap match doc for sparse input #8554
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
|
Your history looks a bit weird, e.g. you have some commits from your work on t-SNE perplexity. Can you fix that? |
|
Please use "Fix #issueNumber" this way the associated issue gets closed automatically when the PR is merged. For more details, look at this. Note this pattern is not flexible so using "Fix issue #issueNumber" or "Fix for #issueNumber" is not going to work. I have edited your description. |
|
Sorry about that -- apparently I got my branching mixed up and had a separate patch carried into this. Should be good now. |
sklearn/manifold/locally_linear.py
Outdated
| Parameters | ||
| ---------- | ||
| X : {array-like, sparse matrix, BallTree, KDTree, NearestNeighbors} | ||
| X : array-like |
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 don't know this code well at all but I found at least one instance where a NearestNeighbors object can be passed as the first argument here. What made you reach the conclusion it was not supported?
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 tried passing in ball trees and kd trees directly to the function and failed on the call to
data = barycenter_weights(X, X[ind], reg=reg)
due to the indexing. If NearestNeighbors et al. all actually work I can certainly restore that.
|
Is this outdated now by other changes? If so please feel free to close it. If not I would appreciate a review if and when time is available. Thanks. |
|
Thanks for the friendly ping, LGTM. If someone that is more familiar with the manifold code than me can have a look, in particular double-check #8554 (comment), |
sklearn/manifold/locally_linear.py
Outdated
| Parameters | ||
| ---------- | ||
| X : {array-like, sparse matrix, BallTree, KDTree, NearestNeighbors} | ||
| X : {array-like, BallTree, KDTree, NearestNeighbors} |
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 can confirm this is not working for me with a *Tree, but is working with a NearestNeighbors. Surely we should have a test to that effect?
I updated the docstrings to a version that seems to be the consensus, i.e. array-like or NearestNeighbors. I quickly run the tests with a print statement and we do have tests for locally_linear_embedding that takes X as a NearestNeighbors object. I have no idea about the CircleCI failure but I would just ignore this one. @jnothman should we had a whats_new entry that says that Isomap can now fit a sparse matrix? |
|
yes, call it a bug fix or an enhancement
|
ccbdf58 to
c70ab9e
Compare
c70ab9e to
3ed93ec
Compare
doc/whats_new/v0.20.rst
Outdated
| `Tom Dupre la Tour`_. | ||
|
|
||
| - Support sparse input in :meth:`manifold.Isomap.fit`. :issue:`8554` by | ||
| :user:`lmcinnes`. |
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.
Should say name here
Fix #8416
Isomap does, in fact support sparse input. Code was changed to match the documentation, and a test was added to verify that it doesn't error.
LLE does not support sparse input -- the
barycenter_kneighbors_graphfunction makes use of fancy indexing which is not supported by sparse matrices. Further the claim of support for KDTree, BallTree and NearestNeighbor objects turned out to be false as well. Docs were updated to reflect this.