-
Notifications
You must be signed in to change notification settings - Fork 184
WIP: Enable array api support in neighbor #2700
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
Draft
yuejiaointel
wants to merge
80
commits into
uxlfoundation:main
Choose a base branch
from
yuejiaointel:refactor_neighbor_array_api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+967
−444
Draft
Changes from 66 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
82fc26d
refactor: move/delete some methods in neighbors.py
yuejiaointel 325753c
fix: try it again
yuejiaointel d17bb34
fix: try it again
yuejiaointel 0e8b4c6
fix: try it again
yuejiaointel 9dda937
fix: first round of refactor move preprocssing function to sklearnex
yuejiaointel 8bd86c2
fix: fix shape
yuejiaointel debfcdf
rebase: rebase to main
yuejiaointel e9e7306
fix: add fit emthod logic in onedla
yuejiaointel 02da9e9
fix: fix test
yuejiaointel 62c8ddd
fix: fix tupleerror
yuejiaointel fc296b5
fix: fix tuple issue
yuejiaointel fe0abbb
print: print fit_x
yuejiaointel e202e65
fix: fixed tuple
yuejiaointel 649fc5d
fix: fix tuple
yuejiaointel a1f95f1
print: print in save attributes
yuejiaointel 939a4f6
fix: tuple handling
yuejiaointel a4b1351
print: add print
yuejiaointel 39ae6c5
print: test print
yuejiaointel aa98829
test: test fix for typle
yuejiaointel 2f834d0
fix: more print
yuejiaointel dcf5b43
fix: test fix for tuyple issue
yuejiaointel 9c65647
fix: test fix for tuyple issue
yuejiaointel b33834d
fix: try add validation
yuejiaointel 96762db
fix: try restore neighbors funcitons
yuejiaointel cc2293c
fix: test restore
yuejiaointel 19fe8ce
fix: restore again
yuejiaointel 0f37c1b
fix: restpore
yuejiaointel f984c42
fix: restore ad and add print
yuejiaointel f372bcb
fix: restore ad and add print
yuejiaointel 169df26
fix: fix test as well
yuejiaointel 2a2a800
fix: fix test
yuejiaointel 4377198
fix: comment out validate data
yuejiaointel 50f9b9d
fix: refactoredclassifier prepressing to sklearnex
yuejiaointel 833f7ab
fix: add vlaidate data and see if it fix attributeerror
yuejiaointel a2af2ef
fix: fix onedal test
yuejiaointel 0b601f9
fix: dpm
yuejiaointel 97f9bd1
fix: refacto validate n classes
yuejiaointel e5300ca
fix: refacor kneighbors validation
yuejiaointel ae590e9
fix: add vlaidation data to rest of the functions
yuejiaointel 0a2850e
fix: fix check n neighbors validation before check is fitted
yuejiaointel 24bd02d
fix: fix when predict(none) is called by adding x is not none check
yuejiaointel 2702322
fix: fix lof
yuejiaointel 965389e
fix: add validation in kneihbors for lof
yuejiaointel 5b8b091
fix: remove count valitation in onedal
yuejiaointel 5e54b86
fix: refactor shape
yuejiaointel b16ecc8
refactor: neighbors processing logic to skleranex
yuejiaointel 8c89422
fix: validationeighbors < samples after +1
yuejiaointel 273a084
fix: fix assertion error
yuejiaointel 35afada
fix: fix asswertion error by dispatch gpu/skl in sklearnex
yuejiaointel 8cccb1d
refacor: onedal prediciton entirely to sklearnex
yuejiaointel 5e01257
feature: array api in common.py
yuejiaointel 8bec3dc
fix: assertion error
yuejiaointel bbab97a
feature: add array api support to knn skleranex files
yuejiaointel aab0100
fix: compatiibilty for array api
yuejiaointel 7574ef5
fix: remove validate data tests from deseleted tests
yuejiaointel dd74a72
Merge branch 'main' into refactor_neighbor_array_api
yuejiaointel 591eb56
fix: format
yuejiaointel 342b838
fix: remove ensure finite and reformat
yuejiaointel a46cc59
fix: format
yuejiaointel 43283cd
fix: fix patching type error
yuejiaointel d734e1f
fix: update doc
yuejiaointel 8c9246d
fix: fix patching error
yuejiaointel 4cb7ed3
fix: attribute error
yuejiaointel 95fff21
fix: patchnig AttributeError
yuejiaointel b250c46
fix: remove print and commented code
yuejiaointel a05d284
fix: format
yuejiaointel cf1d44d
fix: fix conformance test
yuejiaointel c2104ac
fix: format
yuejiaointel 503bf49
fix: clean up unneeded var
yuejiaointel b4e6423
fix: attributeerror
yuejiaointel f3c949b
fix: spmd also use skelarnex neighbors
yuejiaointel db8070d
test: test without classes_check in onedal neighbor
yuejiaointel 65b160b
fix: spmd issue
yuejiaointel 231eb32
fix: format
yuejiaointel 64bb25e
fix: make sure y is numeric in regrresor
yuejiaointel 9dfcb70
fix: fix spmd test
yuejiaointel 93fcbfd
fix: common tests
yuejiaointel 295be53
fix: spmd issues
yuejiaointel db1e130
fix: format
yuejiaointel 4077898
fix: fix metric value
yuejiaointel 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,15 +19,19 @@ | |
| from numpy.testing import assert_array_equal | ||
| from sklearn import datasets | ||
|
|
||
| from onedal.neighbors import KNeighborsClassifier | ||
| from onedal.tests.utils._device_selection import get_queues | ||
|
|
||
| # Classification processing now happens in sklearnex layer | ||
| from sklearnex.neighbors import KNeighborsClassifier | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("queue", get_queues()) | ||
| def test_iris(queue): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is now moved from daal4py, please add a test that the classifier class |
||
| # queue parameter not used with sklearnex, but kept for test parametrization | ||
| iris = datasets.load_iris() | ||
| clf = KNeighborsClassifier(2).fit(iris.data, iris.target, queue=queue) | ||
| assert clf.score(iris.data, iris.target, queue=queue) > 0.9 | ||
| clf = KNeighborsClassifier(2).fit(iris.data, iris.target) | ||
| score = clf.score(iris.data, iris.target) | ||
| assert score > 0.9 | ||
| assert_array_equal(clf.classes_, np.sort(clf.classes_)) | ||
|
|
||
|
|
||
|
|
@@ -36,14 +40,13 @@ def test_pickle(queue): | |
| if queue and queue.sycl_device.is_gpu: | ||
| pytest.skip("KNN classifier pickling for the GPU sycl_queue is buggy.") | ||
| iris = datasets.load_iris() | ||
| clf = KNeighborsClassifier(2).fit(iris.data, iris.target, queue=queue) | ||
| expected = clf.predict(iris.data, queue=queue) | ||
|
|
||
| clf = KNeighborsClassifier(2).fit(iris.data, iris.target) | ||
| expected = clf.predict(iris.data) | ||
| import pickle | ||
|
|
||
| dump = pickle.dumps(clf) | ||
| clf2 = pickle.loads(dump) | ||
|
|
||
| assert type(clf2) == clf.__class__ | ||
| result = clf2.predict(iris.data, queue=queue) | ||
| result = clf2.predict(iris.data) | ||
| assert_array_equal(expected, result) | ||
This file contains hidden or 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.
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.
If this is the case, it'd make more sense to move this test to that folder.