Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
0e7253e
refactor: move/delete some methods in neighbors.py
yuejiaointel Oct 6, 2025
dd0a1b8
fix: try it again
yuejiaointel Oct 6, 2025
396d8b0
fix: try it again
yuejiaointel Oct 6, 2025
ee573d3
fix: try it again
yuejiaointel Oct 6, 2025
6c7a140
fix: first round of refactor move preprocssing function to sklearnex
yuejiaointel Oct 6, 2025
79cd77e
fix: fix shape
yuejiaointel Oct 7, 2025
e580a7b
rebase: rebase to main
yuejiaointel Oct 7, 2025
87fe40c
fix: add fit emthod logic in onedla
yuejiaointel Oct 7, 2025
a8ec297
fix: fix test
yuejiaointel Oct 7, 2025
44b6e95
fix: fix tupleerror
yuejiaointel Oct 8, 2025
8822854
fix: fix tuple issue
yuejiaointel Oct 9, 2025
cc909bc
print: print fit_x
yuejiaointel Oct 10, 2025
46c7759
fix: fixed tuple
yuejiaointel Oct 10, 2025
61c9fe2
fix: fix tuple
yuejiaointel Oct 10, 2025
48c5301
print: print in save attributes
yuejiaointel Oct 10, 2025
375666e
fix: tuple handling
yuejiaointel Oct 10, 2025
b896e94
print: add print
yuejiaointel Oct 10, 2025
b620628
print: test print
yuejiaointel Oct 10, 2025
061558e
test: test fix for typle
yuejiaointel Oct 13, 2025
d224279
fix: more print
yuejiaointel Oct 13, 2025
fdd59a4
fix: test fix for tuyple issue
yuejiaointel Oct 13, 2025
d9ddb36
fix: test fix for tuyple issue
yuejiaointel Oct 13, 2025
b8118df
fix: try add validation
yuejiaointel Oct 13, 2025
15436d8
fix: try restore neighbors funcitons
yuejiaointel Oct 14, 2025
704f550
fix: test restore
yuejiaointel Oct 14, 2025
6c3df79
fix: restore again
yuejiaointel Oct 14, 2025
0e4280f
fix: restpore
yuejiaointel Oct 14, 2025
ad3f210
fix: restore ad and add print
yuejiaointel Oct 14, 2025
b08b302
fix: restore ad and add print
yuejiaointel Oct 14, 2025
a5279e3
fix: fix test as well
yuejiaointel Oct 14, 2025
76f7b06
fix: fix test
yuejiaointel Oct 14, 2025
00459ee
fix: comment out validate data
yuejiaointel Oct 14, 2025
ad41e3f
fix: refactoredclassifier prepressing to sklearnex
yuejiaointel Oct 14, 2025
88bef92
fix: add vlaidate data and see if it fix attributeerror
yuejiaointel Oct 14, 2025
2c8add1
fix: fix onedal test
yuejiaointel Oct 14, 2025
a858828
fix: dpm
yuejiaointel Oct 14, 2025
8ff20ee
fix: refacto validate n classes
yuejiaointel Oct 14, 2025
8b8bab2
fix: refacor kneighbors validation
yuejiaointel Oct 15, 2025
c705ed5
fix: add vlaidation data to rest of the functions
yuejiaointel Oct 15, 2025
b3d5b88
fix: fix check n neighbors validation before check is fitted
yuejiaointel Oct 15, 2025
5ef2fcb
fix: fix when predict(none) is called by adding x is not none check
yuejiaointel Oct 15, 2025
89f72fc
fix: fix lof
yuejiaointel Oct 15, 2025
fbea2da
fix: add validation in kneihbors for lof
yuejiaointel Oct 15, 2025
e12a896
fix: remove count valitation in onedal
yuejiaointel Oct 15, 2025
a1840a2
fix: refactor shape
yuejiaointel Oct 15, 2025
04e6b1a
refactor: neighbors processing logic to skleranex
yuejiaointel Oct 15, 2025
8042448
fix: validationeighbors < samples after +1
yuejiaointel Oct 15, 2025
ab8af22
fix: fix assertion error
yuejiaointel Oct 16, 2025
67d4a38
fix: fix asswertion error by dispatch gpu/skl in sklearnex
yuejiaointel Oct 16, 2025
093bbca
refacor: onedal prediciton entirely to sklearnex
yuejiaointel Oct 16, 2025
8cb4712
feature: array api in common.py
yuejiaointel Oct 16, 2025
2388ef0
fix: assertion error
yuejiaointel Oct 17, 2025
a046838
feature: add array api support to knn skleranex files
yuejiaointel Oct 18, 2025
49b0774
fix: compatiibilty for array api
yuejiaointel Oct 20, 2025
a587bbc
fix: remove validate data tests from deseleted tests
yuejiaointel Oct 20, 2025
5308d92
fix: format
yuejiaointel Oct 20, 2025
261f8f8
fix: remove ensure finite and reformat
yuejiaointel Oct 20, 2025
a1d22c1
fix: format
yuejiaointel Oct 20, 2025
c3629f0
fix: fix patching type error
yuejiaointel Oct 20, 2025
9b41267
fix: update doc
yuejiaointel Oct 20, 2025
2d28e32
fix: fix patching error
yuejiaointel Oct 20, 2025
fc978fd
fix: attribute error
yuejiaointel Oct 21, 2025
a45c7ed
fix: patchnig AttributeError
yuejiaointel Oct 21, 2025
bb48123
fix: remove print and commented code
yuejiaointel Oct 21, 2025
773fb7c
fix: format
yuejiaointel Oct 21, 2025
c102649
fix: fix conformance test
yuejiaointel Oct 21, 2025
c03bdbd
fix: format
yuejiaointel Oct 21, 2025
26b3f69
fix: clean up unneeded var
yuejiaointel Oct 21, 2025
b9fb65a
fix: attributeerror
yuejiaointel Oct 21, 2025
600adea
fix: spmd also use skelarnex neighbors
yuejiaointel Oct 22, 2025
e9e9d8c
test: test without classes_check in onedal neighbor
yuejiaointel Oct 22, 2025
17eb4c5
fix: spmd issue
yuejiaointel Oct 23, 2025
f84b197
fix: format
yuejiaointel Oct 23, 2025
0bece91
fix: make sure y is numeric in regrresor
yuejiaointel Oct 24, 2025
790372c
fix: fix spmd test
yuejiaointel Oct 24, 2025
62a51de
fix: common tests
yuejiaointel Oct 24, 2025
d99bec1
fix: spmd issues
yuejiaointel Oct 24, 2025
25e16a7
fix: format
yuejiaointel Oct 24, 2025
c7f3aba
fix: fix metric value
yuejiaointel Oct 26, 2025
e9ae663
fix: stability test
yuejiaointel Oct 27, 2025
7c69298
fix: test
yuejiaointel Oct 27, 2025
5a69e86
fix: fix patching error
yuejiaointel Oct 27, 2025
0123220
fix: spmd preduct
yuejiaointel Oct 27, 2025
913b489
fix: validate y for regressor
yuejiaointel Oct 27, 2025
f2f6de5
test: try regressor without ynumric but verify it ouside validate dat
yuejiaointel Oct 28, 2025
f28700a
fix: foloow ridge patten ensure y numberic requrie ksnearln >=1.5
yuejiaointel Oct 28, 2025
cd6be2c
fix: test without manual convertion
yuejiaointel Oct 29, 2025
705b334
fix: add violation back
yuejiaointel Jan 22, 2026
98ca37e
fix: add rst back
yuejiaointel Jan 22, 2026
655cd99
fix: add the dunmmy check back
yuejiaointel Jan 22, 2026
da026d2
fix: fix the reshape
yuejiaointel Jan 22, 2026
a021dc6
fix: add post processing to onedal
yuejiaointel Jan 22, 2026
dbc899c
fix: kneighbors
yuejiaointel Jan 22, 2026
72ca287
Merge branch 'main' into refactor_neighbor_array_api
yuejiaointel Jan 22, 2026
1c339a5
fix: remove post prossing from skelarnex
yuejiaointel Jan 22, 2026
c60c3dd
fix: format
yuejiaointel Jan 22, 2026
0818dcb
fix: format
yuejiaointel Jan 22, 2026
3f096b0
fix: fix spmd
yuejiaointel Jan 30, 2026
7fad6cc
fix: fix spmd test
yuejiaointel Jan 30, 2026
f784db2
fix: format
yuejiaointel Jan 30, 2026
221b822
fix: lof tests
yuejiaointel Jan 30, 2026
c568a9a
fix: format
yuejiaointel Jan 30, 2026
06010d0
fix: fix example test
yuejiaointel Feb 2, 2026
0c51482
fix: fix spmd neighbor again with runtime lookup
yuejiaointel Feb 2, 2026
fd1c499
fix: spmd synetic test
yuejiaointel Feb 2, 2026
05d27c4
fix: lof case
yuejiaointel Feb 2, 2026
6132976
fix: format
yuejiaointel Feb 2, 2026
9c59b66
fix: address past comments again except refactoring
yuejiaointel Feb 2, 2026
fe558f3
fix: dtype
yuejiaointel Feb 2, 2026
6b8d8f8
fix: fix check onedal estimator
yuejiaointel Feb 3, 2026
4efd964
fix: remove unused function and refactoring
yuejiaointel Feb 3, 2026
e457590
fix: change to hasattr
yuejiaointel Feb 3, 2026
0a21734
fix: bring some funcitons back
yuejiaointel Feb 3, 2026
7f21c86
fix: format
yuejiaointel Feb 3, 2026
65996fe
fix: remove comments
yuejiaointel Feb 5, 2026
2774fe4
fix: performance
yuejiaointel Feb 6, 2026
80c0ba8
fix: add validation
yuejiaointel Feb 6, 2026
3d2bc5b
fix: validate data
yuejiaointel Feb 6, 2026
f872b88
fix: validate data
yuejiaointel Feb 6, 2026
6f8bd2a
fix: validate data
yuejiaointel Feb 6, 2026
bdd5411
fix: validate data
yuejiaointel Feb 7, 2026
c6500f0
fix: validate data
yuejiaointel Feb 7, 2026
c1c6cfc
fix: validate data
yuejiaointel Feb 8, 2026
e2580ba
fix validate
yuejiaointel Feb 8, 2026
1d45b8c
fix: performnace
yuejiaointel Feb 9, 2026
d77b866
fix: validate data
yuejiaointel Feb 9, 2026
c1981cb
fix: performance
yuejiaointel Feb 10, 2026
7ee0ae2
fix: performance and add spmd array api dispatch flag
yuejiaointel Feb 10, 2026
46b7562
fix: gpu errors
yuejiaointel Feb 10, 2026
81b0c0b
fix: comments
yuejiaointel Feb 10, 2026
7a0f72d
fix: gpu
yuejiaointel Feb 10, 2026
3b5801d
fix: fix spmd
yuejiaointel Feb 11, 2026
444aa3f
fix: added onedal device offload changes in #2940
yuejiaointel Feb 11, 2026
b677cf6
fix: comments
yuejiaointel Feb 11, 2026
15c7c3c
fix: comments
yuejiaointel Feb 12, 2026
44b1c4e
fix: get array from namespace for gpu data
yuejiaointel Feb 12, 2026
ac959d7
fix: comments
yuejiaointel Feb 12, 2026
be92806
fix: device offload with standalone functions to hanlde converstion
yuejiaointel Feb 12, 2026
e662a1f
revert: restore onedal/_device_offload.py to main (defer to #2940)
yuejiaointel Feb 12, 2026
3e239e8
fix: add multi output true
yuejiaointel Feb 12, 2026
b0273e9
fix: let non sycl arrays gpu input fall back to sklearn
yuejiaointel Feb 12, 2026
cd77d8d
fix: simpliy unique_inverse
yuejiaointel Feb 12, 2026
03c0df8
fix: reverse as numpy < 2.0 does not have np.unqieu_inverse
yuejiaointel Feb 12, 2026
6b695c2
Fix unique_inverse result unpacking for Python 3.13 compatibility
yuejiaointel Feb 12, 2026
65421a3
fix: allow numpy arrays in _onedal_gpu_supported for dpctl/dpnp path
yuejiaointel Feb 12, 2026
f024233
fix: ondal support
yuejiaointel Feb 12, 2026
0a9f7e9
fix: gpu test
yuejiaointel Feb 14, 2026
e642455
fix: format
yuejiaointel Feb 14, 2026
afc6e84
fix: comments
yuejiaointel Feb 16, 2026
daaf10a
fix: gpu test
yuejiaointel Feb 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/sources/array_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ The following patched classes have support for array API inputs:
- :obj:`sklearn.linear_model.Ridge`
- :obj:`sklearnex.linear_model.IncrementalLinearRegression`
- :obj:`sklearnex.linear_model.IncrementalRidge`
- :obj:`sklearn.neighbors.KNeighborsClassifier`
- :obj:`sklearn.neighbors.KNeighborsRegressor`
- :obj:`sklearn.neighbors.NearestNeighbors`
- :obj:`sklearn.neighbors.LocalOutlierFactor`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this now runs on GPU, then please add it to the support table in algorithms.rst.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it does, but this list is not exclusively GPU algorithms

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuejiaointel @ethanglaser I have it a try and both onedal and sklearnex report that it runs on GPU:

INFO:sklearnex: sklearn.neighbors.LocalOutlierFactor.fit: running accelerated version on GPU
-----------------------------------------------------------------------------
File: cpp/oneapi/dal/backend/primitives/search/search_dpc.cpp, Line: 48
Profiler task_name: search.treat_indices, q
search.treat_indices 24.89ms
search.squared_l2.inner_blocking 249.78ms
-----------------------------------------------------------------------------
File: cpp/oneapi/dal/backend/primitives/search/search_dpc.cpp, Line: 608
Profiler task_name: selection_loop.selection, this->get_queue()
-----------------------------------------------------------------------------

But some things I'm not clear whether they are CPU or GPU:

-----------------------------------------------------------------------------
File: [./cpp/oneapi/dal/backend/primitives/reduction/reduction.hpp](https://vscode-remote+ssh-002dremote-002bsdpdal630226-002ejf-002eintel-002ecom.vscode-resource.vscode-cdn.net/export/users/dcortes/repos/sklex-dpnp/cpp/oneapi/dal/backend/primitives/reduction/reduction.hpp), Line: 60
Profiler task_name: reduction.reduce_by_rows, q
reduction.reduce_by_rows 40.87ms
-----------------------------------------------------------------------------
File: [./cpp/oneapi/dal/backend/primitives/reduction/reduction.hpp](https://vscode-remote+ssh-002dremote-002bsdpdal630226-002ejf-002eintel-002ecom.vscode-resource.vscode-cdn.net/export/users/dcortes/repos/sklex-dpnp/cpp/oneapi/dal/backend/primitives/reduction/reduction.hpp), Line: 60
Profiler task_name: reduction.reduce_by_rows, q
reduction.reduce_by_rows 11.97us
-----------------------------------------------------------------------------

@Alexandr-Solovev @Vika-F Could you comment on what's the status of GPU support for LocalOutlierFactor?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently don’t have a native LocalOutlierFactor implementation in oneDAL. There is a CPU-only implementation in the legacy DAAL part, but it is not exposed through oneAPI interfaces. As a result, GPU support for LocalOutlierFactor is not available.

For reference:

self._lrd = self._local_reachability_density(
Looks like our LOF impl is a mix of oneDAL knn call + additional python calls on CPU.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it'd be very easy to port those python parts to array API to run them on GPU, since they only do slicing and max ops.

@Alexandr-Solovev Do I understand it correctly from the logs above that all the operations offloaded to oneDAL are running on GPU?

Example:

import os
os.environ["SCIPY_ARRAY_API"] = "1"
os.environ["SKLEARNEX_VERBOSE"] = "INFO"
os.environ["ONEDAL_VERBOSE"] = "4"

import numpy as np
import dpnp

rng = np.random.default_rng(seed=123)
X = rng.standard_normal(size=(1000, 20), dtype=np.float32)
Xd = dpnp.array(X, device="gpu")

from sklearnex import config_context
from sklearnex.neighbors import LocalOutlierFactor

with config_context(array_api_dispatch=True):
    model = LocalOutlierFactor().fit(Xd)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, all of the operations offloaded to oneDAL from the kernel_profiler log are executed on GPU

- :obj:`sklearn.svm.NuSVC`
- :obj:`sklearn.svm.NuSVR`
- :obj:`sklearn.svm.SVC`
Expand Down
Loading
Loading