scikit-learn-intelex 2023.2.1__py310-none-win_amd64.whl → 2024.0.1__py310-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of scikit-learn-intelex might be problematic. Click here for more details.
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/__init__.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/__main__.py +16 -12
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/_config.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/_device_offload.py +90 -56
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/_utils.py +95 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/cluster/__init__.py +4 -4
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +187 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/cluster/k_means.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +12 -6
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +5 -5
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/decomposition/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/decomposition/pca.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +5 -4
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/dispatcher.py +102 -72
- {scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex}/ensemble/__init__.py +12 -4
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/ensemble/_forest.py +1947 -0
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +118 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/glob/__main__.py +31 -16
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/glob/dispatcher.py +21 -14
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/__init__.py +10 -10
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +2 -2
- {scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex}/linear_model/linear.py +173 -83
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/logistic_path.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/ridge.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +23 -7
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +4 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/manifold/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/manifold/t_sne.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +4 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/metrics/__init__.py +5 -5
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/metrics/pairwise.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/metrics/ranking.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +8 -6
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/model_selection/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/model_selection/split.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +6 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/neighbors/__init__.py +9 -5
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/neighbors/common.py +100 -77
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +331 -0
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +307 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +116 -58
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/neighbors/lof.py +118 -56
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +85 -0
- {scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/decomposition → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview}/__init__.py +18 -20
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/preview/cluster/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/preview/cluster/_common.py +7 -7
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/preview/cluster/k_means.py +104 -73
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/linear_model/linear.py → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +4 -1
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/preview/decomposition/pca.py +128 -100
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_preview_linear.py → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_preview_pca.py +18 -16
- {scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/linear_model → scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/spmd}/__init__.py +24 -22
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +11 -5
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +50 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/decomposition/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +16 -14
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +2 -2
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/neighbors.py +3 -3
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/__init__.py +11 -8
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/_common.py +56 -56
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/nusvc.py +110 -55
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/nusvr.py +65 -31
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/svc.py +136 -78
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/svm/svr.py +65 -31
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +102 -0
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/_models_info.py +170 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/tests/test_config.py +9 -8
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +63 -69
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +55 -53
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/test_parallel.py +50 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/tests/test_patching.py +8 -7
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability_tests.py +428 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/tests/utils/_launch_algorithms.py +39 -39
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/utils/__init__.py +3 -3
- scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/utils/parallel.py +59 -0
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/utils/validation.py +2 -2
- {scikit_learn_intelex-2023.2.1.dist-info → scikit_learn_intelex-2024.0.1.dist-info}/METADATA +34 -35
- scikit_learn_intelex-2024.0.1.dist-info/RECORD +90 -0
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/_utils.py +0 -82
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +0 -18
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/ensemble/__init__.py +0 -20
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/ensemble/forest.py +0 -18
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +0 -46
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +0 -228
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +0 -213
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +0 -57
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/__init__.py +0 -18
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_preview_pca.py +0 -28
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/ensemble/extra_trees.py +0 -1261
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/ensemble/forest.py +0 -1155
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/ensemble/tests/test_preview_ensemble.py +0 -67
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/preview/linear_model/_common.py +0 -66
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/spmd/__init__.py +0 -23
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +0 -63
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/tests/_models_info.py +0 -159
- scikit_learn_intelex-2023.2.1.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability_tests.py +0 -383
- scikit_learn_intelex-2023.2.1.dist-info/RECORD +0 -95
- {scikit_learn_intelex-2023.2.1.data → scikit_learn_intelex-2024.0.1.data}/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +0 -0
- {scikit_learn_intelex-2023.2.1.dist-info → scikit_learn_intelex-2024.0.1.dist-info}/LICENSE.txt +0 -0
- {scikit_learn_intelex-2023.2.1.dist-info → scikit_learn_intelex-2024.0.1.dist-info}/WHEEL +0 -0
- {scikit_learn_intelex-2023.2.1.dist-info → scikit_learn_intelex-2024.0.1.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
#
|
|
2
|
+
# ==============================================================================
|
|
3
3
|
# Copyright 2021 Intel Corporation
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
|
-
#
|
|
16
|
+
# ==============================================================================
|
|
17
17
|
|
|
18
18
|
from . import utils
|
|
19
19
|
from ._config import config_context, get_config, set_config
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
|
|
2
|
+
# ==============================================================================
|
|
3
3
|
# Copyright 2021 Intel Corporation
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
|
-
|
|
16
|
+
# ==============================================================================
|
|
17
17
|
|
|
18
18
|
import sys
|
|
19
|
+
|
|
19
20
|
from sklearnex import patch_sklearn
|
|
20
21
|
|
|
21
22
|
|
|
@@ -29,27 +30,30 @@ def _main():
|
|
|
29
30
|
scikit-learn, optimizing solvers of
|
|
30
31
|
scikit-learn with Intel(R) oneAPI Data Analytics Library.
|
|
31
32
|
""",
|
|
32
|
-
formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"-m", action="store_true", dest="module", help="Executes following as a module"
|
|
38
|
+
)
|
|
39
|
+
parser.add_argument("name", help="Script or module name")
|
|
40
|
+
parser.add_argument("args", nargs=argparse.REMAINDER, help="Command line arguments")
|
|
39
41
|
args = parser.parse_args()
|
|
40
42
|
|
|
41
43
|
try:
|
|
42
44
|
import sklearn
|
|
45
|
+
|
|
43
46
|
patch_sklearn()
|
|
44
47
|
except ImportError:
|
|
45
48
|
print("Scikit-learn could not be imported. Nothing to patch")
|
|
46
49
|
|
|
47
50
|
sys.argv = [args.name] + args.args
|
|
48
|
-
if
|
|
49
|
-
return globals()[
|
|
51
|
+
if "_" + args.name in globals():
|
|
52
|
+
return globals()["_" + args.name](*args.args)
|
|
50
53
|
import runpy
|
|
54
|
+
|
|
51
55
|
runf = runpy.run_module if args.module else runpy.run_path
|
|
52
|
-
runf(args.name, run_name=
|
|
56
|
+
runf(args.name, run_name="__main__")
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
sys.exit(_main())
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# ==============================================================================
|
|
2
2
|
# Copyright 2021 Intel Corporation
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
|
|
15
|
+
# ==============================================================================
|
|
16
16
|
|
|
17
17
|
import threading
|
|
18
18
|
from contextlib import contextmanager
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# ==============================================================================
|
|
2
2
|
# Copyright 2021 Intel Corporation
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12,44 +12,56 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
|
|
15
|
+
# ==============================================================================
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
import logging
|
|
18
|
+
import sys
|
|
19
19
|
from functools import wraps
|
|
20
|
+
|
|
20
21
|
import numpy as np
|
|
21
|
-
import sys
|
|
22
|
-
import logging
|
|
23
22
|
|
|
24
23
|
try:
|
|
25
24
|
from dpctl import SyclQueue
|
|
26
25
|
from dpctl.memory import MemoryUSMDevice, as_usm_memory
|
|
27
26
|
from dpctl.tensor import usm_ndarray
|
|
27
|
+
|
|
28
28
|
dpctl_available = True
|
|
29
29
|
except ImportError:
|
|
30
30
|
dpctl_available = False
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
try:
|
|
33
|
+
import dpnp
|
|
34
|
+
|
|
35
|
+
dpnp_available = True
|
|
36
|
+
except ImportError:
|
|
37
|
+
dpnp_available = False
|
|
38
|
+
|
|
39
|
+
from ._config import get_config
|
|
40
|
+
from ._utils import get_patch_message
|
|
41
|
+
|
|
42
|
+
oneapi_is_available = "daal4py.oneapi" in sys.modules
|
|
33
43
|
if oneapi_is_available:
|
|
34
44
|
from daal4py.oneapi import _get_device_name_sycl_ctxt, _get_sycl_ctxt_params
|
|
35
45
|
|
|
36
46
|
|
|
37
47
|
class DummySyclQueue:
|
|
38
|
-
|
|
39
|
-
to allow device dispatching in scenarios when dpctl is not available
|
|
48
|
+
"""This class is designed to act like dpctl.SyclQueue
|
|
49
|
+
to allow device dispatching in scenarios when dpctl is not available"""
|
|
40
50
|
|
|
41
51
|
class DummySyclDevice:
|
|
42
52
|
def __init__(self, filter_string):
|
|
43
53
|
self._filter_string = filter_string
|
|
44
|
-
self.is_cpu =
|
|
45
|
-
self.is_gpu =
|
|
54
|
+
self.is_cpu = "cpu" in filter_string
|
|
55
|
+
self.is_gpu = "gpu" in filter_string
|
|
46
56
|
# TODO: check for possibility of fp64 support
|
|
47
57
|
# on other devices in this dummy class
|
|
48
58
|
self.has_aspect_fp64 = self.is_cpu
|
|
49
59
|
|
|
50
60
|
if not (self.is_cpu):
|
|
51
|
-
logging.warning(
|
|
52
|
-
|
|
61
|
+
logging.warning(
|
|
62
|
+
"Device support is limited. "
|
|
63
|
+
"Please install dpctl for full experience"
|
|
64
|
+
)
|
|
53
65
|
|
|
54
66
|
def get_filter_string(self):
|
|
55
67
|
return self._filter_string
|
|
@@ -65,23 +77,26 @@ def _get_device_info_from_daal4py():
|
|
|
65
77
|
|
|
66
78
|
|
|
67
79
|
def _get_global_queue():
|
|
68
|
-
target = get_config()[
|
|
80
|
+
target = get_config()["target_offload"]
|
|
69
81
|
d4p_target, _ = _get_device_info_from_daal4py()
|
|
70
|
-
if d4p_target ==
|
|
71
|
-
d4p_target =
|
|
82
|
+
if d4p_target == "host":
|
|
83
|
+
d4p_target = "cpu"
|
|
72
84
|
|
|
73
85
|
QueueClass = DummySyclQueue if not dpctl_available else SyclQueue
|
|
74
86
|
|
|
75
|
-
if target !=
|
|
76
|
-
if d4p_target is not None and
|
|
77
|
-
d4p_target != target:
|
|
87
|
+
if target != "auto":
|
|
88
|
+
if d4p_target is not None and d4p_target != target:
|
|
78
89
|
if not isinstance(target, str):
|
|
79
90
|
if d4p_target not in target.sycl_device.get_filter_string():
|
|
80
|
-
raise RuntimeError(
|
|
81
|
-
|
|
91
|
+
raise RuntimeError(
|
|
92
|
+
"Cannot use target offload option "
|
|
93
|
+
"inside daal4py.oneapi.sycl_context"
|
|
94
|
+
)
|
|
82
95
|
else:
|
|
83
|
-
raise RuntimeError(
|
|
84
|
-
|
|
96
|
+
raise RuntimeError(
|
|
97
|
+
"Cannot use target offload option "
|
|
98
|
+
"inside daal4py.oneapi.sycl_context"
|
|
99
|
+
)
|
|
85
100
|
if isinstance(target, QueueClass):
|
|
86
101
|
return target
|
|
87
102
|
return QueueClass(target)
|
|
@@ -95,22 +110,25 @@ def _transfer_to_host(queue, *data):
|
|
|
95
110
|
|
|
96
111
|
host_data = []
|
|
97
112
|
for item in data:
|
|
98
|
-
usm_iface = getattr(item,
|
|
113
|
+
usm_iface = getattr(item, "__sycl_usm_array_interface__", None)
|
|
99
114
|
if usm_iface is not None:
|
|
100
115
|
if not dpctl_available:
|
|
101
|
-
raise RuntimeError(
|
|
102
|
-
|
|
116
|
+
raise RuntimeError(
|
|
117
|
+
"dpctl need to be installed to work "
|
|
118
|
+
"with __sycl_usm_array_interface__"
|
|
119
|
+
)
|
|
103
120
|
if queue is not None:
|
|
104
|
-
if queue.sycl_device != usm_iface[
|
|
105
|
-
raise RuntimeError(
|
|
106
|
-
|
|
121
|
+
if queue.sycl_device != usm_iface["syclobj"].sycl_device:
|
|
122
|
+
raise RuntimeError(
|
|
123
|
+
"Input data shall be located " "on single target device"
|
|
124
|
+
)
|
|
107
125
|
else:
|
|
108
|
-
queue = usm_iface[
|
|
126
|
+
queue = usm_iface["syclobj"]
|
|
109
127
|
|
|
110
128
|
buffer = as_usm_memory(item).copy_to_host()
|
|
111
|
-
item = np.ndarray(
|
|
112
|
-
|
|
113
|
-
|
|
129
|
+
item = np.ndarray(
|
|
130
|
+
shape=usm_iface["shape"], dtype=usm_iface["typestr"], buffer=buffer
|
|
131
|
+
)
|
|
114
132
|
has_usm_data = True
|
|
115
133
|
else:
|
|
116
134
|
has_host_data = True
|
|
@@ -119,7 +137,7 @@ def _transfer_to_host(queue, *data):
|
|
|
119
137
|
mismatch_usm_item = usm_iface is not None and has_host_data
|
|
120
138
|
|
|
121
139
|
if mismatch_host_item or mismatch_usm_item:
|
|
122
|
-
raise RuntimeError(
|
|
140
|
+
raise RuntimeError("Input data shall be located on single target device")
|
|
123
141
|
|
|
124
142
|
host_data.append(item)
|
|
125
143
|
return queue, host_data
|
|
@@ -128,23 +146,32 @@ def _transfer_to_host(queue, *data):
|
|
|
128
146
|
def _get_backend(obj, queue, method_name, *data):
|
|
129
147
|
cpu_device = queue is None or queue.sycl_device.is_cpu
|
|
130
148
|
gpu_device = queue is not None and queue.sycl_device.is_gpu
|
|
131
|
-
cpu_fallback = False
|
|
132
149
|
|
|
133
|
-
if (cpu_device and obj._onedal_cpu_supported(method_name, *data)) or \
|
|
134
|
-
(gpu_device and obj._onedal_gpu_supported(method_name, *data)):
|
|
135
|
-
return 'onedal', queue, cpu_fallback
|
|
136
150
|
if cpu_device:
|
|
137
|
-
|
|
151
|
+
patching_status = obj._onedal_cpu_supported(method_name, *data)
|
|
152
|
+
if patching_status.get_status():
|
|
153
|
+
return "onedal", queue, patching_status
|
|
154
|
+
else:
|
|
155
|
+
return "sklearn", None, patching_status
|
|
138
156
|
|
|
139
157
|
_, d4p_options = _get_device_info_from_daal4py()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
158
|
+
allow_fallback_to_host = get_config()["allow_fallback_to_host"] or d4p_options.get(
|
|
159
|
+
"host_offload_on_fail", False
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
if gpu_device:
|
|
163
|
+
patching_status = obj._onedal_gpu_supported(method_name, *data)
|
|
164
|
+
if patching_status.get_status():
|
|
165
|
+
return "onedal", queue, patching_status
|
|
166
|
+
else:
|
|
167
|
+
if allow_fallback_to_host:
|
|
168
|
+
patching_status = obj._onedal_cpu_supported(method_name, *data)
|
|
169
|
+
if patching_status.get_status():
|
|
170
|
+
return "onedal", None, patching_status
|
|
171
|
+
else:
|
|
172
|
+
return "sklearn", None, patching_status
|
|
173
|
+
else:
|
|
174
|
+
return "sklearn", None, patching_status
|
|
148
175
|
|
|
149
176
|
raise RuntimeError("Device support is not implemented")
|
|
150
177
|
|
|
@@ -155,20 +182,24 @@ def dispatch(obj, method_name, branches, *args, **kwargs):
|
|
|
155
182
|
q, hostvalues = _transfer_to_host(q, *kwargs.values())
|
|
156
183
|
hostkwargs = dict(zip(kwargs.keys(), hostvalues))
|
|
157
184
|
|
|
158
|
-
backend, q,
|
|
185
|
+
backend, q, patching_status = _get_backend(obj, q, method_name, *hostargs)
|
|
159
186
|
|
|
160
|
-
if backend ==
|
|
187
|
+
if backend == "onedal":
|
|
188
|
+
patching_status.write_log(queue=q)
|
|
161
189
|
return branches[backend](obj, *hostargs, **hostkwargs, queue=q)
|
|
162
|
-
if backend ==
|
|
190
|
+
if backend == "sklearn":
|
|
191
|
+
patching_status.write_log()
|
|
163
192
|
return branches[backend](obj, *hostargs, **hostkwargs)
|
|
164
|
-
raise RuntimeError(
|
|
165
|
-
|
|
193
|
+
raise RuntimeError(
|
|
194
|
+
f"Undefined backend {backend} in " f"{obj.__class__.__name__}.{method_name}"
|
|
195
|
+
)
|
|
166
196
|
|
|
167
197
|
|
|
168
198
|
def _copy_to_usm(queue, array):
|
|
169
199
|
if not dpctl_available:
|
|
170
|
-
raise RuntimeError(
|
|
171
|
-
|
|
200
|
+
raise RuntimeError(
|
|
201
|
+
"dpctl need to be installed to work " "with __sycl_usm_array_interface__"
|
|
202
|
+
)
|
|
172
203
|
mem = MemoryUSMDevice(array.nbytes, queue=queue)
|
|
173
204
|
mem.copy_from_host(array.tobytes())
|
|
174
205
|
return usm_ndarray(array.shape, array.dtype, buffer=mem)
|
|
@@ -181,9 +212,12 @@ def wrap_output_data(func):
|
|
|
181
212
|
if len(data) == 0:
|
|
182
213
|
usm_iface = None
|
|
183
214
|
else:
|
|
184
|
-
usm_iface = getattr(data[0],
|
|
215
|
+
usm_iface = getattr(data[0], "__sycl_usm_array_interface__", None)
|
|
185
216
|
result = func(self, *args, **kwargs)
|
|
186
217
|
if usm_iface is not None:
|
|
187
|
-
|
|
218
|
+
result = _copy_to_usm(usm_iface["syclobj"], result)
|
|
219
|
+
if dpnp_available and isinstance(data[0], dpnp.ndarray):
|
|
220
|
+
result = dpnp.array(result, copy=False)
|
|
188
221
|
return result
|
|
222
|
+
|
|
189
223
|
return wrapper
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# ===============================================================================
|
|
3
|
+
# Copyright 2021 Intel Corporation
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
# ===============================================================================
|
|
17
|
+
|
|
18
|
+
import logging
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
import warnings
|
|
22
|
+
|
|
23
|
+
from daal4py.sklearn._utils import (
|
|
24
|
+
PatchingConditionsChain as daal4py_PatchingConditionsChain,
|
|
25
|
+
)
|
|
26
|
+
from daal4py.sklearn._utils import daal_check_version
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class PatchingConditionsChain(daal4py_PatchingConditionsChain):
|
|
30
|
+
def get_status(self):
|
|
31
|
+
return self.patching_is_enabled
|
|
32
|
+
|
|
33
|
+
def write_log(self, queue=None):
|
|
34
|
+
if self.patching_is_enabled:
|
|
35
|
+
self.logger.info(
|
|
36
|
+
f"{self.scope_name}: {get_patch_message('onedal', queue=queue)}"
|
|
37
|
+
)
|
|
38
|
+
else:
|
|
39
|
+
self.logger.debug(
|
|
40
|
+
f"{self.scope_name}: debugging for the patch is enabled to track"
|
|
41
|
+
" the usage of Intel® oneAPI Data Analytics Library (oneDAL)"
|
|
42
|
+
)
|
|
43
|
+
for message in self.messages:
|
|
44
|
+
self.logger.debug(
|
|
45
|
+
f"{self.scope_name}: patching failed with cause - {message}"
|
|
46
|
+
)
|
|
47
|
+
self.logger.info(f"{self.scope_name}: {get_patch_message('sklearn')}")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def set_sklearn_ex_verbose():
|
|
51
|
+
log_level = os.environ.get("SKLEARNEX_VERBOSE")
|
|
52
|
+
|
|
53
|
+
logger = logging.getLogger("sklearnex")
|
|
54
|
+
logging_channel = logging.StreamHandler()
|
|
55
|
+
logging_formatter = logging.Formatter("%(levelname)s:%(name)s: %(message)s")
|
|
56
|
+
logging_channel.setFormatter(logging_formatter)
|
|
57
|
+
logger.addHandler(logging_channel)
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
if log_level is not None:
|
|
61
|
+
logger.setLevel(log_level)
|
|
62
|
+
except Exception:
|
|
63
|
+
warnings.warn(
|
|
64
|
+
'Unknown level "{}" for logging.\n'
|
|
65
|
+
'Please, use one of "CRITICAL", "ERROR", '
|
|
66
|
+
'"WARNING", "INFO", "DEBUG".'.format(log_level)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def get_patch_message(s, queue=None):
|
|
71
|
+
if s == "onedal":
|
|
72
|
+
message = "running accelerated version on "
|
|
73
|
+
if queue is not None:
|
|
74
|
+
if queue.sycl_device.is_gpu:
|
|
75
|
+
message += "GPU"
|
|
76
|
+
elif queue.sycl_device.is_cpu:
|
|
77
|
+
message += "CPU"
|
|
78
|
+
else:
|
|
79
|
+
raise RuntimeError("Unsupported device")
|
|
80
|
+
else:
|
|
81
|
+
message += "CPU"
|
|
82
|
+
elif s == "sklearn":
|
|
83
|
+
message = "fallback to original Scikit-learn"
|
|
84
|
+
elif s == "sklearn_after_onedal":
|
|
85
|
+
message = "failed to run accelerated version, fallback to original Scikit-learn"
|
|
86
|
+
else:
|
|
87
|
+
raise ValueError(
|
|
88
|
+
f"Invalid input - expected one of 'onedal','sklearn',"
|
|
89
|
+
f" 'sklearn_after_onedal', got {s}"
|
|
90
|
+
)
|
|
91
|
+
return message
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_sklearnex_version(rule):
|
|
95
|
+
return daal_check_version(rule)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
|
|
2
|
+
# ==============================================================================
|
|
3
3
|
# Copyright 2023 Intel Corporation
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
|
-
|
|
16
|
+
# ==============================================================================
|
|
17
17
|
|
|
18
18
|
from .basic_statistics import BasicStatistics
|
|
19
19
|
|
|
20
|
-
__all__ = [
|
|
20
|
+
__all__ = ["BasicStatistics"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# ==============================================================================
|
|
2
2
|
# Copyright 2023 Intel Corporation
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
|
|
15
|
+
# ==============================================================================
|
|
16
16
|
|
|
17
17
|
from onedal.basic_statistics import BasicStatistics
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
|
|
2
|
+
# ===============================================================================
|
|
3
3
|
# Copyright 2021 Intel Corporation
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
|
-
|
|
16
|
+
# ===============================================================================
|
|
17
17
|
|
|
18
|
-
from .k_means import KMeans
|
|
19
18
|
from .dbscan import DBSCAN
|
|
19
|
+
from .k_means import KMeans
|
|
20
20
|
|
|
21
|
-
__all__ = [
|
|
21
|
+
__all__ = ["KMeans", "DBSCAN"]
|