Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ENH duck-typing scikit-learn estimator instead of inheritance #858
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
ENH duck-typing scikit-learn estimator instead of inheritance #858
Changes from 2 commits
d17b6b5
379ea7e
8790628
e997e23
94b0725
9fbf360
f736879
fcb118e
a4e959c
65ae4fd
5b76d49
8284b70
e97ae36
495ec27
10456f5
93200e1
f104057
b82e4d9
70b6778
c67c775
010f4d5
178d0f0
9868d0f
2e1ee17
8889cfd
5e875a0
9545172
29a414b
12991ba
e24ee06
525002f
189f0e9
2cbe273
cc7fae9
29e4619
a098e84
0aa328e
8cce474
8d4ff31
0ceacfb
ee6b7b0
d089b7b
ac7e00a
d815e2d
964d082
99d5206
48d1fd5
18b6057
76fbd59
8fa97ed
615a2bf
b75b77d
b627cf1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think that we should as well change the error message since we don't strictly require to be a
KNeighborsMixin
but instead to expose bothkneighbors
andkneighbors_graph
.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 have been debating between two implementations here (my two latest commits [1 2]).
[1] uses sklearn.base.clone to verify that the nn_object is an sklearn-like estimator that can be cloned. This implementation is more consistent with how the library checks the integrity of other estimators - such as the KMeans Estimator check in
KMeansSmote
, but it does not protect users from the mistake of inputting other types of estimators.[2] raises a TypeError if the nn_object is neither an integer, nor exposes both
kneighbors
andkneighbors_graph
; thus, it protects users from this potential mistake.Do you prefer one over the other?