-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merged
glemaitre
merged 53 commits into
scikit-learn-contrib:master
from
NV-jpt:ducktype-check_neighbors
Jan 16, 2022
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
d17b6b5
add duck-type check for KNeighbors-likeness
379ea7e
removal ofKNeighborsMixin type check
8790628
Added _is_neighbors_object() private validation function
e997e23
Addded pep8lank lines
94b0725
change isinstance check for SVM estimator to simply clone the estimat…
9fbf360
remove explicit class-check for KMeans estimator
f736879
remove explicit class check for KNeighborsClassifier
fcb118e
remove explicit class check for KNeighborsClassifier in CondensedNear…
a4e959c
remove explicit class check for ClassifierMixin in InstanceHardnessTh…
65ae4fd
PEP 8 issue fix
5b76d49
PEP 8 issue fix - line break before operator
8284b70
PEP 8 issue fix - no more line break before operator
e97ae36
Undo changes to _instance_hardness_threshold
495ec27
revert OneSidedSelection changes
10456f5
Undo changes to CondensedNearestNeighbour
93200e1
example NearestNeighbors test
f104057
Use sklearn.base.clone to validate NN object and throw error
b82e4d9
undo last commit, and raise nn_object TypeError
70b6778
remove unused imports
c67c775
Add test for cuml ADASYN
010f4d5
Updated check_neighbors_object docstring and error type
178d0f0
Updated tests
9868d0f
Merge branch 'master' into ducktype-check_neighbors
NV-jpt 2e1ee17
Merge remote-tracking branch 'origin/master' into pr/NV-jpt/858
glemaitre 8889cfd
duck-typing svm
glemaitre 5e875a0
TST add couple of tests
glemaitre 9545172
better error message with duck-typing
glemaitre 29a414b
iter
glemaitre 12991ba
CI let's try a run on CircleCI with cuML
glemaitre e24ee06
iter
glemaitre 525002f
iter
glemaitre 189f0e9
iter
glemaitre 2cbe273
iter
glemaitre cc7fae9
iter
glemaitre 29e4619
ITER
glemaitre a098e84
iter
glemaitre 0aa328e
iter
glemaitre 8cce474
dbg
glemaitre 8d4ff31
dbg
glemaitre 0ceacfb
MNT move to circleci
glemaitre ee6b7b0
iter
glemaitre d089b7b
iter
glemaitre ac7e00a
Merge remote-tracking branch 'origin/master' into pr/NV-jpt/858
glemaitre d815e2d
create custom NN class
glemaitre 964d082
add test no dependent on cupy
glemaitre 99d5206
update documentation
glemaitre 48d1fd5
iter
glemaitre 18b6057
iter
glemaitre 76fbd59
revert redirector
glemaitre 8fa97ed
add changelog
glemaitre 615a2bf
remove duplicated test
glemaitre b75b77d
make testing function private
glemaitre b627cf1
iter
glemaitre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
This change removes the explicit
isinstance
check for validating the SVC estimator in SVMSMOTE's_validate_estimator
method; the estimator is instead validated by way ofsklearn.base.clone()
, similar to that ofKMeansSMOTE
.This will enable the integration of SVM estimators that enforce the same API contract as sklearn instead of requiring the explicit class check (
isinstance(svm_estimator, sklearn.svm.SVC)
)As a motivating example, the integration of a GPU-accelerated SVC from cuML can offer significant performance gains when working with large datasets.
Hardware Specs for the Loose Benchmark:
Intel Xeon E5-2698, 2.2 GHz, 16-cores & NVIDIA V100 32 GB GPU
Benchmarking gist:
https://gist.github.com/NV-jpt/039a8d9c7d37365379faa1d7c7aafc5e