scikit-learn-intelex 2024.5.0__py311-none-manylinux1_x86_64.whl → 2024.6.0__py311-none-manylinux1_x86_64.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-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/METADATA +2 -2
- {scikit_learn_intelex-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/RECORD +34 -30
- sklearnex/cluster/dbscan.py +3 -0
- sklearnex/cluster/tests/test_dbscan.py +8 -6
- sklearnex/conftest.py +11 -1
- sklearnex/decomposition/tests/test_pca.py +4 -2
- sklearnex/dispatcher.py +15 -1
- sklearnex/ensemble/_forest.py +114 -23
- sklearnex/ensemble/tests/test_forest.py +13 -3
- sklearnex/glob/dispatcher.py +16 -2
- sklearnex/linear_model/incremental_linear.py +102 -25
- sklearnex/linear_model/linear.py +25 -7
- sklearnex/linear_model/logistic_regression.py +13 -15
- sklearnex/linear_model/tests/test_incremental_linear.py +10 -10
- sklearnex/linear_model/tests/test_linear.py +2 -2
- sklearnex/neighbors/knn_regression.py +24 -0
- sklearnex/preview/__init__.py +1 -1
- sklearnex/preview/decomposition/__init__.py +19 -0
- sklearnex/preview/decomposition/incremental_pca.py +228 -0
- sklearnex/preview/decomposition/tests/test_incremental_pca.py +266 -0
- sklearnex/svm/_common.py +165 -20
- sklearnex/svm/nusvc.py +40 -4
- sklearnex/svm/nusvr.py +31 -2
- sklearnex/svm/svc.py +40 -4
- sklearnex/svm/svr.py +31 -2
- sklearnex/tests/_utils.py +49 -17
- sklearnex/tests/test_common.py +54 -0
- sklearnex/tests/test_memory_usage.py +185 -126
- sklearnex/tests/test_patching.py +5 -12
- sklearnex/tests/test_run_to_run_stability.py +283 -0
- sklearnex/utils/_namespace.py +1 -1
- sklearnex/tests/test_run_to_run_stability_tests.py +0 -428
- {scikit_learn_intelex-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/LICENSE.txt +0 -0
- {scikit_learn_intelex-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/WHEEL +0 -0
- {scikit_learn_intelex-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/top_level.txt +0 -0
{scikit_learn_intelex-2024.5.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scikit-learn-intelex
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.6.0
|
|
4
4
|
Summary: Intel(R) Extension for Scikit-learn is a seamless way to speed up your Scikit-learn application.
|
|
5
5
|
Home-page: https://github.com/intel/scikit-learn-intelex
|
|
6
6
|
Author: Intel Corporation
|
|
@@ -31,7 +31,7 @@ Classifier: Topic :: Software Development
|
|
|
31
31
|
Requires-Python: >=3.7
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
33
|
License-File: LICENSE.txt
|
|
34
|
-
Requires-Dist: daal4py (==2024.
|
|
34
|
+
Requires-Dist: daal4py (==2024.6.0)
|
|
35
35
|
Requires-Dist: scikit-learn (>=0.22)
|
|
36
36
|
|
|
37
37
|
|
|
@@ -3,38 +3,38 @@ sklearnex/__main__.py,sha256=Le9BJq6aLEGSSoZwJLsOADxsV89ynBfA8BcoJHk9F24,1921
|
|
|
3
3
|
sklearnex/_config.py,sha256=6WS3UuS4-0DxIJyGn7yQMosj-mGkLybLQrg3W7dED5o,3928
|
|
4
4
|
sklearnex/_device_offload.py,sha256=m8Hspffwx6Tn3f-OYLqwf5cUCKq4vZ3aSLmhY92qp08,8876
|
|
5
5
|
sklearnex/_utils.py,sha256=EV4jC3plVdndsgrfPBsJZTzggrRdYWLwOpoIRWtTXt4,3812
|
|
6
|
-
sklearnex/conftest.py,sha256=
|
|
7
|
-
sklearnex/dispatcher.py,sha256=
|
|
6
|
+
sklearnex/conftest.py,sha256=ODuhlscC0HNGXiA8olEfHTDULzjevqG9_sn0yMGRkHg,2376
|
|
7
|
+
sklearnex/dispatcher.py,sha256=XElvy9dDJ8XNOci8asKUnWXJpr6JROXHehdWBc_od3g,15876
|
|
8
8
|
sklearnex/basic_statistics/__init__.py,sha256=-lNh54F2FO0BuHDBLjhW7zp3yBcgFZ-DrXHj2H5hLXE,920
|
|
9
9
|
sklearnex/basic_statistics/basic_statistics.py,sha256=j5jBZ3DgXjoyjCBEFfYQHyl3LgLXEWWFnNHwInThdZw,796
|
|
10
10
|
sklearnex/basic_statistics/incremental_basic_statistics.py,sha256=NNWF9zdxBz2jT7dzt5hL6HRvjQIGosvViQE3KJMF1L4,10048
|
|
11
11
|
sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py,sha256=zTb_04DBGYSfwcpRaP0OJzi4Z6jz4jqV_kDRAp1x-no,14926
|
|
12
12
|
sklearnex/cluster/__init__.py,sha256=TsDzdbKzEubaP86iY8a7mSW0ZQzgjzGYuPkhc5lZmlQ,853
|
|
13
|
-
sklearnex/cluster/dbscan.py,sha256=
|
|
13
|
+
sklearnex/cluster/dbscan.py,sha256=EiAMRZq53KhGQ_d4_c867-frgG-pz8S1J88vd8hLAn4,6844
|
|
14
14
|
sklearnex/cluster/k_means.py,sha256=1QKcFUQcnycu8kSD8uYSaDIuedHbxZsV_gvUfcEwVAM,806
|
|
15
|
-
sklearnex/cluster/tests/test_dbscan.py,sha256=
|
|
15
|
+
sklearnex/cluster/tests/test_dbscan.py,sha256=JYpwyuPkGQHdbE_IPbQv4qNj7clMm4UPdz_lrpRzKXE,1504
|
|
16
16
|
sklearnex/cluster/tests/test_kmeans.py,sha256=H3a9NSHRRSASo0Eceo44Kjq6GwEoMqMzcubaNt1s1QQ,1213
|
|
17
17
|
sklearnex/covariance/__init__.py,sha256=_c86wiKDGBH50ofN-_tn7lO4M2YVEWO5AHhJIfimUDk,859
|
|
18
18
|
sklearnex/covariance/incremental_covariance.py,sha256=0MvYlGnmuZ8_kRBaIkMzg3RyGdcSMjO-I7dhw2VpTsg,11010
|
|
19
19
|
sklearnex/covariance/tests/test_incremental_covariance.py,sha256=ZbEfup4ICm278RW4hZIHPciOiqhFhx_k1l3lpnw0M6s,6763
|
|
20
20
|
sklearnex/decomposition/__init__.py,sha256=RJBYDWyvnn5DA-j5r4IqVdXLp6H4mdPySsSjnXhlv-U,805
|
|
21
21
|
sklearnex/decomposition/pca.py,sha256=JkyxsSz_8vVGUjJrfxyAwwY1Yf2uht-qxwOisEHv9mY,15550
|
|
22
|
-
sklearnex/decomposition/tests/test_pca.py,sha256
|
|
22
|
+
sklearnex/decomposition/tests/test_pca.py,sha256=EoCgpSojE2S2e7hOUwW0Bh3vVGTUywawAhU7ThVAlW0,2319
|
|
23
23
|
sklearnex/doc/third-party-programs.txt,sha256=qA1XbOqYkMRnp29p8VxXjfcH0kHE8NSO5s2heea83-8,21773
|
|
24
24
|
sklearnex/ensemble/__init__.py,sha256=2xB2KfG7l7uJv0p3kfVhrs4KLM174SCsigZhYqwSYAA,1035
|
|
25
|
-
sklearnex/ensemble/_forest.py,sha256=
|
|
26
|
-
sklearnex/ensemble/tests/test_forest.py,sha256=
|
|
25
|
+
sklearnex/ensemble/_forest.py,sha256=tElkh0jezrp9QK2T3_kDCgye6El9W6hOlJepaeMIOM4,73494
|
|
26
|
+
sklearnex/ensemble/tests/test_forest.py,sha256=UXj6pfSuOr8wm_KZciyE9zt6hh-we1U8s0XU9bShqHI,4735
|
|
27
27
|
sklearnex/glob/__main__.py,sha256=--FAjkhh5E6a1TFOGu6_BM3MHe78jP8oSpl0xKiRtTI,2531
|
|
28
|
-
sklearnex/glob/dispatcher.py,sha256=
|
|
28
|
+
sklearnex/glob/dispatcher.py,sha256=o6XKGKM3M91F7FlXBOt1IhnpWQK4R1VY2WS-0uIghcw,3906
|
|
29
29
|
sklearnex/linear_model/__init__.py,sha256=mzZ0EaBhDH66ETNt2vylznSoZbCYexgL2qE_jKppYYc,1144
|
|
30
30
|
sklearnex/linear_model/coordinate_descent.py,sha256=uZOHIKfFlHoMlNXZCh2MAnZE30fRZlmtcF7UsZQ3Vq4,822
|
|
31
|
-
sklearnex/linear_model/incremental_linear.py,sha256=
|
|
32
|
-
sklearnex/linear_model/linear.py,sha256=
|
|
31
|
+
sklearnex/linear_model/incremental_linear.py,sha256=iDad4Z4xMDImvG-Jgtt0Hz3Qp9MVhSi-IjUPcV0Y_ks,16101
|
|
32
|
+
sklearnex/linear_model/linear.py,sha256=SUoFFvpl4Eb308sYBp6FNbZls-4G69eg8wSeuPs0oAg,11765
|
|
33
33
|
sklearnex/linear_model/logistic_path.py,sha256=Nq3JPXSzE4bjamnP3gGQtsMKks2v7s6bSiuYRnFqrRw,849
|
|
34
|
-
sklearnex/linear_model/logistic_regression.py,sha256=
|
|
34
|
+
sklearnex/linear_model/logistic_regression.py,sha256=jmsNs7MYHm-PncuG20m_TSqXbM5jXx_vHsoH-hReEFQ,14271
|
|
35
35
|
sklearnex/linear_model/ridge.py,sha256=0oxlM5McYYvl0KxK9OIGJKM6lOADuFSPTdfx-efJNTI,810
|
|
36
|
-
sklearnex/linear_model/tests/test_incremental_linear.py,sha256=
|
|
37
|
-
sklearnex/linear_model/tests/test_linear.py,sha256=
|
|
36
|
+
sklearnex/linear_model/tests/test_incremental_linear.py,sha256=e0ZADjB0myq1QcdwYxlVYl6tGFs4tVZIfBoV1xkdFuw,7337
|
|
37
|
+
sklearnex/linear_model/tests/test_linear.py,sha256=9YQgyYmcGSL2rEgIfhZZxTIlj5v-Z6-ygBqYR6ly3oE,4357
|
|
38
38
|
sklearnex/linear_model/tests/test_logreg.py,sha256=mUYDwTDUekERlzxjnVeOeCUcNv4KJAXdTIiELZNSaDc,3283
|
|
39
39
|
sklearnex/manifold/__init__.py,sha256=3FU5fY1YvHAyNeSlUHsZfPnAbvlAUtZpum0Obmok2KE,809
|
|
40
40
|
sklearnex/manifold/t_sne.py,sha256=U6F_dGB6taVuEJvTnVBWD-sri3x3m0Khu3HI4wXidhg,805
|
|
@@ -50,16 +50,19 @@ sklearnex/neighbors/__init__.py,sha256=_GMJ2L-6YechRYI2fOFwHjy0kebUncE81z4FmdXUl
|
|
|
50
50
|
sklearnex/neighbors/_lof.py,sha256=5MPkWIb6FS55Q8xWzgc22Ec_PsouuN94SPovt-vsBGE,8648
|
|
51
51
|
sklearnex/neighbors/common.py,sha256=8DxDoYtXtEM4RNoMCimpTVSDOOxUIJlNVOQvBXBhkd4,10875
|
|
52
52
|
sklearnex/neighbors/knn_classification.py,sha256=ONoBbtwb5xoVLcpg5COpRNu1ZBOQ2EDh03RzbWDy5yo,8537
|
|
53
|
-
sklearnex/neighbors/knn_regression.py,sha256=
|
|
53
|
+
sklearnex/neighbors/knn_regression.py,sha256=ge8VAMa8aJ58M5ccN5NMILFHuRYtYKzyoLF8fxxgGfo,7462
|
|
54
54
|
sklearnex/neighbors/knn_unsupervised.py,sha256=qkj-hSEq8QetYsWlofnik3PpFvo1iBUbIOhywo8wFWk,5362
|
|
55
55
|
sklearnex/neighbors/tests/test_neighbors.py,sha256=yAlMnLt9GrdT6Ceph5B7iFuMJXpDURiHWTE99oO8EDw,3417
|
|
56
|
-
sklearnex/preview/__init__.py,sha256=
|
|
56
|
+
sklearnex/preview/__init__.py,sha256=1QcbV6xCSP7QCXRxYLVPc_b4lxE0cQiyTrMm4xOnosM,797
|
|
57
57
|
sklearnex/preview/cluster/__init__.py,sha256=FONzOuTGAb5NwdfFhLco99P_VccRk9NBkDHU3EKuAIs,794
|
|
58
58
|
sklearnex/preview/cluster/_common.py,sha256=bgpzijxgyrAtdNCCHyCNsZ-N70KQYNwMuoCTNdUna6o,2718
|
|
59
59
|
sklearnex/preview/cluster/k_means.py,sha256=RdF9mwgvZ1xgyeLhCQA2WaPvPsS1ndktXXcaNj6S460,10464
|
|
60
60
|
sklearnex/preview/covariance/__init__.py,sha256=DPYTk8lwcVphtwU8J3CyUYH8Uz6Zr0Uz4S6nn-RY5iM,825
|
|
61
61
|
sklearnex/preview/covariance/covariance.py,sha256=NjRTWLie7UbpfN16wGSxJSRHRhUnvTn03cPPc8PpPd8,5131
|
|
62
62
|
sklearnex/preview/covariance/tests/test_covariance.py,sha256=FOgvhJxFQo9sNG4Uo-ebuw3ZXJ9tSxdk8qKm0ZJzTdc,2487
|
|
63
|
+
sklearnex/preview/decomposition/__init__.py,sha256=9VcJPWKgSrWDFEXUY6ZCpAT2XGbOVA4a1j_XgfJBnTM,839
|
|
64
|
+
sklearnex/preview/decomposition/incremental_pca.py,sha256=SsY1-AQt0mFTJGP5yzVxZvopNz2tSeXUO9p9c_3uVus,7820
|
|
65
|
+
sklearnex/preview/decomposition/tests/test_incremental_pca.py,sha256=tsAlM18nzfIQxic7Ry986Ue0ovUdbopWFNckqQLK5xU,10776
|
|
63
66
|
sklearnex/spmd/__init__.py,sha256=ChQy2kEWlo4KGvs0RnbPoPEVhdgl8URV099B1rZtF5Y,889
|
|
64
67
|
sklearnex/spmd/basic_statistics/__init__.py,sha256=NA5RGlwcp27UEeCgz0ngzYYd3MAIRpxlTy86uhM2-RE,821
|
|
65
68
|
sklearnex/spmd/basic_statistics/basic_statistics.py,sha256=_dQ9mhVYxeuChATEpAmHpXDpgW3YvtK1qrG-kLr2MtI,886
|
|
@@ -78,27 +81,28 @@ sklearnex/spmd/linear_model/logistic_regression.py,sha256=q_HkfWcg0RgFbk2t9FeV0Z
|
|
|
78
81
|
sklearnex/spmd/neighbors/__init__.py,sha256=S16sH8N_18LN_8AgC_wGK5EDSNyuN-F-gI6GVlaiWVE,906
|
|
79
82
|
sklearnex/spmd/neighbors/neighbors.py,sha256=SiKAS_RVt34MUcGytBS5pHnI_5vFNxJn8jqt1MOhDh8,940
|
|
80
83
|
sklearnex/svm/__init__.py,sha256=f3e4ZFwZfx6MsXsn94VK1xVm6mWKT5XCiHczo6zNyAQ,1057
|
|
81
|
-
sklearnex/svm/_common.py,sha256=
|
|
82
|
-
sklearnex/svm/nusvc.py,sha256
|
|
83
|
-
sklearnex/svm/nusvr.py,sha256=
|
|
84
|
-
sklearnex/svm/svc.py,sha256=
|
|
85
|
-
sklearnex/svm/svr.py,sha256=
|
|
84
|
+
sklearnex/svm/_common.py,sha256=wH4LT6QIoe7xM3btaUBC7fpKJcqKLfNHJj16rAaEZ1k,12797
|
|
85
|
+
sklearnex/svm/nusvc.py,sha256=-SfYz2bUMLaosYg_qeTBYf1Ra-bFuGmI62xIerf3XeE,11262
|
|
86
|
+
sklearnex/svm/nusvr.py,sha256=9nbRaPCoDQ5SBGH_jLgcaX_PWGDh667w-gW5X2YbHBM,4764
|
|
87
|
+
sklearnex/svm/svc.py,sha256=fZ9oVpKkgH5OYBXo4mPdZ-8cP07hSzPHoJsyItpXmcQ,12470
|
|
88
|
+
sklearnex/svm/svr.py,sha256=NIWVUu7NjV4Fe4L-Y4vIqd3KePFdMJ1-jupeH4ZvNsg,4733
|
|
86
89
|
sklearnex/svm/tests/test_svm.py,sha256=Ru-aGNGCsRJts7SEEYbnKcVqUx-DqPyUtw-hEoMVpW8,4190
|
|
87
|
-
sklearnex/tests/_utils.py,sha256=
|
|
90
|
+
sklearnex/tests/_utils.py,sha256=zRNpggSrZs4H0L-__UuiYRPm_ASqrqWm226ZQzlBQ7I,6252
|
|
91
|
+
sklearnex/tests/test_common.py,sha256=MYx0y7oomArxWu9qe2zNs7YL-ScPGFnzvw8PZ1or04A,1813
|
|
88
92
|
sklearnex/tests/test_config.py,sha256=SnSJjxAAysISDyC3bYKSJiRHStkB9X-yjLeF11LpRog,1372
|
|
89
|
-
sklearnex/tests/test_memory_usage.py,sha256=
|
|
93
|
+
sklearnex/tests/test_memory_usage.py,sha256=FTtQgaa7p5ScDGscB93LkpU4B3DzfqnVMi84b2vSL30,10957
|
|
90
94
|
sklearnex/tests/test_monkeypatch.py,sha256=_9s_4jFvbttOf8uCuBrS4rn_AzQdFlKyRlthnGacUcU,9669
|
|
91
95
|
sklearnex/tests/test_n_jobs_support.py,sha256=NziTP4GwZEDoBe1CDvhHZnp8JpwjYQmCNvXEDfS7Wo4,4313
|
|
92
96
|
sklearnex/tests/test_parallel.py,sha256=0zzlh2VJZWcHw5W4QSUthtAygOb6K0Bg1ekNsrdGJQE,1770
|
|
93
|
-
sklearnex/tests/test_patching.py,sha256=
|
|
94
|
-
sklearnex/tests/
|
|
97
|
+
sklearnex/tests/test_patching.py,sha256=LKi-x0ELu_y5HEa86UYhDzOalJphiEBtEe5own89PEs,14782
|
|
98
|
+
sklearnex/tests/test_run_to_run_stability.py,sha256=49WnqTcAaGGa5eP7RBwEePvr_dA9hfYsCK4-pZA8OPw,9984
|
|
95
99
|
sklearnex/utils/__init__.py,sha256=FFlM8zc2qnSdPYpLjSt4Ma_9FjC8qk8wXJa-5B8hCs0,898
|
|
96
|
-
sklearnex/utils/_namespace.py,sha256=
|
|
100
|
+
sklearnex/utils/_namespace.py,sha256=ohr8gOgEFgrccLecllMVYQPqbqqyye9uT-cWLtyxHFs,3167
|
|
97
101
|
sklearnex/utils/parallel.py,sha256=VBcS-KUdyq7XpJUN6ygmNjyWtYLroghbvCxQ8nVU3YI,2085
|
|
98
102
|
sklearnex/utils/validation.py,sha256=fjfhQiKnBQnD7LCBlacMyvsrhGnlMLRXk5Q69uoZIP4,827
|
|
99
103
|
sklearnex/utils/tests/test_finite.py,sha256=AzJRY71X0VvDUicUI8Ey9Le6_yKp5O-3ZikhDVJNWms,2943
|
|
100
|
-
scikit_learn_intelex-2024.
|
|
101
|
-
scikit_learn_intelex-2024.
|
|
102
|
-
scikit_learn_intelex-2024.
|
|
103
|
-
scikit_learn_intelex-2024.
|
|
104
|
-
scikit_learn_intelex-2024.
|
|
104
|
+
scikit_learn_intelex-2024.6.0.dist-info/LICENSE.txt,sha256=7micbUpzQXphq9e_2oL7PpZcvoXzPuQHIDEXyKXC81s,10797
|
|
105
|
+
scikit_learn_intelex-2024.6.0.dist-info/METADATA,sha256=HAyHGB0wdXHb5FaRHSiitrRZgs5yDtXkjfAigVtQJxA,12449
|
|
106
|
+
scikit_learn_intelex-2024.6.0.dist-info/WHEEL,sha256=nUImGVghXI3BbWH-HS5yME2RP5X-J5sfF99vWXe2MpQ,108
|
|
107
|
+
scikit_learn_intelex-2024.6.0.dist-info/top_level.txt,sha256=kzKChSWGJEYFmdj5PwE63HNuP_PVOhWfD32ytH9rL9Q,10
|
|
108
|
+
scikit_learn_intelex-2024.6.0.dist-info/RECORD,,
|
sklearnex/cluster/dbscan.py
CHANGED
|
@@ -85,6 +85,9 @@ class DBSCAN(sklearn_DBSCAN, BaseDBSCAN):
|
|
|
85
85
|
self.n_jobs = n_jobs
|
|
86
86
|
|
|
87
87
|
def _onedal_fit(self, X, y, sample_weight=None, queue=None):
|
|
88
|
+
if sklearn_check_version("1.0"):
|
|
89
|
+
X = self._validate_data(X, force_all_finite=False)
|
|
90
|
+
|
|
88
91
|
onedal_params = {
|
|
89
92
|
"eps": self.eps,
|
|
90
93
|
"min_samples": self.min_samples,
|
|
@@ -18,16 +18,18 @@ import numpy as np
|
|
|
18
18
|
import pytest
|
|
19
19
|
from numpy.testing import assert_allclose
|
|
20
20
|
|
|
21
|
+
from onedal.tests.utils._dataframes_support import (
|
|
22
|
+
_convert_to_dataframe,
|
|
23
|
+
get_dataframes_and_queues,
|
|
24
|
+
)
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# sklearnex/tests/test_monkeypatch.py::test_preview_namespace.
|
|
26
|
-
# @pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
27
|
-
def test_sklearnex_import_dbscan():
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
28
|
+
def test_sklearnex_import_dbscan(dataframe, queue):
|
|
28
29
|
from sklearnex.cluster import DBSCAN
|
|
29
30
|
|
|
30
31
|
X = np.array([[1, 2], [2, 2], [2, 3], [8, 7], [8, 8], [25, 80]])
|
|
32
|
+
X = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
31
33
|
dbscan = DBSCAN(eps=3, min_samples=2).fit(X)
|
|
32
34
|
assert "sklearnex" in dbscan.__module__
|
|
33
35
|
|
sklearnex/conftest.py
CHANGED
|
@@ -19,7 +19,8 @@ import logging
|
|
|
19
19
|
|
|
20
20
|
import pytest
|
|
21
21
|
|
|
22
|
-
from
|
|
22
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
23
|
+
from sklearnex import config_context, patch_sklearn, unpatch_sklearn
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def pytest_configure(config):
|
|
@@ -61,3 +62,12 @@ def with_sklearnex():
|
|
|
61
62
|
patch_sklearn()
|
|
62
63
|
yield
|
|
63
64
|
unpatch_sklearn()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@pytest.fixture
|
|
68
|
+
def with_array_api():
|
|
69
|
+
if sklearn_check_version("1.2"):
|
|
70
|
+
with config_context(array_api_dispatch=True):
|
|
71
|
+
yield
|
|
72
|
+
else:
|
|
73
|
+
yield
|
|
@@ -51,6 +51,8 @@ def test_sklearnex_import(dataframe, queue):
|
|
|
51
51
|
assert hasattr(pca, "_onedal_estimator")
|
|
52
52
|
else:
|
|
53
53
|
assert "daal4py" in pca.__module__
|
|
54
|
+
|
|
55
|
+
tol = 1e-5 if _as_numpy(X_transformed).dtype == np.float32 else 1e-7
|
|
54
56
|
assert_allclose([6.30061232, 0.54980396], _as_numpy(pca.singular_values_))
|
|
55
|
-
assert_allclose(X_transformed_expected, _as_numpy(X_transformed))
|
|
56
|
-
assert_allclose(X_transformed_expected, _as_numpy(X_fit_transformed))
|
|
57
|
+
assert_allclose(X_transformed_expected, _as_numpy(X_transformed), rtol=tol)
|
|
58
|
+
assert_allclose(X_transformed_expected, _as_numpy(X_fit_transformed), rtol=tol)
|
sklearnex/dispatcher.py
CHANGED
|
@@ -45,12 +45,14 @@ def get_patch_map_core(preview=False):
|
|
|
45
45
|
|
|
46
46
|
if _is_new_patching_available():
|
|
47
47
|
import sklearn.covariance as covariance_module
|
|
48
|
+
import sklearn.decomposition as decomposition_module
|
|
48
49
|
|
|
49
50
|
# Preview classes for patching
|
|
50
51
|
from .preview.cluster import KMeans as KMeans_sklearnex
|
|
51
52
|
from .preview.covariance import (
|
|
52
53
|
EmpiricalCovariance as EmpiricalCovariance_sklearnex,
|
|
53
54
|
)
|
|
55
|
+
from .preview.decomposition import IncrementalPCA as IncrementalPCA_sklearnex
|
|
54
56
|
|
|
55
57
|
# Since the state of the lru_cache without preview cannot be
|
|
56
58
|
# guaranteed to not have already enabled sklearnex algorithms
|
|
@@ -62,7 +64,7 @@ def get_patch_map_core(preview=False):
|
|
|
62
64
|
sklearn_obj = mapping["kmeans"][0][1]
|
|
63
65
|
mapping.pop("kmeans")
|
|
64
66
|
mapping["kmeans"] = [
|
|
65
|
-
[(cluster_module, "
|
|
67
|
+
[(cluster_module, "KMeans", KMeans_sklearnex), sklearn_obj]
|
|
66
68
|
]
|
|
67
69
|
|
|
68
70
|
# Covariance
|
|
@@ -76,6 +78,18 @@ def get_patch_map_core(preview=False):
|
|
|
76
78
|
None,
|
|
77
79
|
]
|
|
78
80
|
]
|
|
81
|
+
|
|
82
|
+
# IncrementalPCA
|
|
83
|
+
mapping["incrementalpca"] = [
|
|
84
|
+
[
|
|
85
|
+
(
|
|
86
|
+
decomposition_module,
|
|
87
|
+
"IncrementalPCA",
|
|
88
|
+
IncrementalPCA_sklearnex,
|
|
89
|
+
),
|
|
90
|
+
None,
|
|
91
|
+
]
|
|
92
|
+
]
|
|
79
93
|
return mapping
|
|
80
94
|
|
|
81
95
|
from daal4py.sklearn.monkeypatch.dispatcher import _get_map_of_algorithms
|
sklearnex/ensemble/_forest.py
CHANGED
|
@@ -29,7 +29,7 @@ from sklearn.ensemble._forest import ForestClassifier as sklearn_ForestClassifie
|
|
|
29
29
|
from sklearn.ensemble._forest import ForestRegressor as sklearn_ForestRegressor
|
|
30
30
|
from sklearn.ensemble._forest import _get_n_samples_bootstrap
|
|
31
31
|
from sklearn.exceptions import DataConversionWarning
|
|
32
|
-
from sklearn.metrics import accuracy_score
|
|
32
|
+
from sklearn.metrics import accuracy_score, r2_score
|
|
33
33
|
from sklearn.tree import (
|
|
34
34
|
DecisionTreeClassifier,
|
|
35
35
|
DecisionTreeRegressor,
|
|
@@ -38,7 +38,7 @@ from sklearn.tree import (
|
|
|
38
38
|
)
|
|
39
39
|
from sklearn.tree._tree import Tree
|
|
40
40
|
from sklearn.utils import check_random_state, deprecated
|
|
41
|
-
from sklearn.utils.validation import check_array, check_is_fitted
|
|
41
|
+
from sklearn.utils.validation import check_array, check_is_fitted, check_X_y
|
|
42
42
|
|
|
43
43
|
from daal4py.sklearn._n_jobs_support import control_n_jobs
|
|
44
44
|
from daal4py.sklearn._utils import (
|
|
@@ -74,6 +74,7 @@ class BaseForest(ABC):
|
|
|
74
74
|
accept_sparse=False,
|
|
75
75
|
dtype=[np.float64, np.float32],
|
|
76
76
|
force_all_finite=False,
|
|
77
|
+
ensure_2d=True,
|
|
77
78
|
)
|
|
78
79
|
|
|
79
80
|
if sample_weight is not None:
|
|
@@ -97,8 +98,6 @@ class BaseForest(ABC):
|
|
|
97
98
|
|
|
98
99
|
y, expanded_class_weight = self._validate_y_class_weight(y)
|
|
99
100
|
|
|
100
|
-
self.n_features_in_ = X.shape[1]
|
|
101
|
-
|
|
102
101
|
if expanded_class_weight is not None:
|
|
103
102
|
if sample_weight is not None:
|
|
104
103
|
sample_weight = sample_weight * expanded_class_weight
|
|
@@ -114,7 +113,9 @@ class BaseForest(ABC):
|
|
|
114
113
|
"min_samples_split": self.min_samples_split,
|
|
115
114
|
"min_samples_leaf": self.min_samples_leaf,
|
|
116
115
|
"min_weight_fraction_leaf": self.min_weight_fraction_leaf,
|
|
117
|
-
"max_features": self.
|
|
116
|
+
"max_features": self._to_absolute_max_features(
|
|
117
|
+
self.max_features, self.n_features_in_
|
|
118
|
+
),
|
|
118
119
|
"max_leaf_nodes": self.max_leaf_nodes,
|
|
119
120
|
"min_impurity_decrease": self.min_impurity_decrease,
|
|
120
121
|
"bootstrap": self.bootstrap,
|
|
@@ -174,6 +175,45 @@ class BaseForest(ABC):
|
|
|
174
175
|
self._validate_estimator()
|
|
175
176
|
return self
|
|
176
177
|
|
|
178
|
+
def _to_absolute_max_features(self, max_features, n_features):
|
|
179
|
+
if max_features is None:
|
|
180
|
+
return n_features
|
|
181
|
+
if isinstance(max_features, str):
|
|
182
|
+
if max_features == "auto":
|
|
183
|
+
if not sklearn_check_version("1.3"):
|
|
184
|
+
if sklearn_check_version("1.1"):
|
|
185
|
+
warnings.warn(
|
|
186
|
+
"`max_features='auto'` has been deprecated in 1.1 "
|
|
187
|
+
"and will be removed in 1.3. To keep the past behaviour, "
|
|
188
|
+
"explicitly set `max_features=1.0` or remove this "
|
|
189
|
+
"parameter as it is also the default value for "
|
|
190
|
+
"RandomForestRegressors and ExtraTreesRegressors.",
|
|
191
|
+
FutureWarning,
|
|
192
|
+
)
|
|
193
|
+
return (
|
|
194
|
+
max(1, int(np.sqrt(n_features)))
|
|
195
|
+
if isinstance(self, ForestClassifier)
|
|
196
|
+
else n_features
|
|
197
|
+
)
|
|
198
|
+
if max_features == "sqrt":
|
|
199
|
+
return max(1, int(np.sqrt(n_features)))
|
|
200
|
+
if max_features == "log2":
|
|
201
|
+
return max(1, int(np.log2(n_features)))
|
|
202
|
+
allowed_string_values = (
|
|
203
|
+
'"sqrt" or "log2"'
|
|
204
|
+
if sklearn_check_version("1.3")
|
|
205
|
+
else '"auto", "sqrt" or "log2"'
|
|
206
|
+
)
|
|
207
|
+
raise ValueError(
|
|
208
|
+
"Invalid value for max_features. Allowed string "
|
|
209
|
+
f"values are {allowed_string_values}."
|
|
210
|
+
)
|
|
211
|
+
if isinstance(max_features, (numbers.Integral, np.integer)):
|
|
212
|
+
return max_features
|
|
213
|
+
if max_features > 0.0:
|
|
214
|
+
return max(1, int(max_features * n_features))
|
|
215
|
+
return 0
|
|
216
|
+
|
|
177
217
|
def _check_parameters(self):
|
|
178
218
|
if isinstance(self.min_samples_leaf, numbers.Integral):
|
|
179
219
|
if not 1 <= self.min_samples_leaf:
|
|
@@ -518,7 +558,7 @@ class ForestClassifier(sklearn_ForestClassifier, BaseForest):
|
|
|
518
558
|
)
|
|
519
559
|
|
|
520
560
|
if patching_status.get_status():
|
|
521
|
-
X, y =
|
|
561
|
+
X, y = check_X_y(
|
|
522
562
|
X,
|
|
523
563
|
y,
|
|
524
564
|
multi_output=True,
|
|
@@ -738,6 +778,10 @@ class ForestClassifier(sklearn_ForestClassifier, BaseForest):
|
|
|
738
778
|
or self.estimator.__class__ == DecisionTreeClassifier,
|
|
739
779
|
"ExtraTrees only supported starting from oneDAL version 2023.1",
|
|
740
780
|
),
|
|
781
|
+
(
|
|
782
|
+
not self.oob_score,
|
|
783
|
+
"oob_scores using r2 or accuracy not implemented.",
|
|
784
|
+
),
|
|
741
785
|
(sample_weight is None, "sample_weight is not supported."),
|
|
742
786
|
]
|
|
743
787
|
)
|
|
@@ -780,24 +824,43 @@ class ForestClassifier(sklearn_ForestClassifier, BaseForest):
|
|
|
780
824
|
check_is_fitted(self, "_onedal_estimator")
|
|
781
825
|
|
|
782
826
|
if sklearn_check_version("1.0"):
|
|
783
|
-
self.
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
827
|
+
X = self._validate_data(
|
|
828
|
+
X,
|
|
829
|
+
dtype=[np.float64, np.float32],
|
|
830
|
+
force_all_finite=False,
|
|
831
|
+
reset=False,
|
|
832
|
+
ensure_2d=True,
|
|
833
|
+
)
|
|
834
|
+
else:
|
|
835
|
+
X = check_array(
|
|
836
|
+
X,
|
|
837
|
+
dtype=[np.float64, np.float32],
|
|
838
|
+
force_all_finite=False,
|
|
839
|
+
) # Warning, order of dtype matters
|
|
840
|
+
self._check_n_features(X, reset=False)
|
|
790
841
|
|
|
791
842
|
res = self._onedal_estimator.predict(X, queue=queue)
|
|
792
843
|
return np.take(self.classes_, res.ravel().astype(np.int64, casting="unsafe"))
|
|
793
844
|
|
|
794
845
|
def _onedal_predict_proba(self, X, queue=None):
|
|
795
|
-
X = check_array(X, dtype=[np.float64, np.float32], force_all_finite=False)
|
|
796
846
|
check_is_fitted(self, "_onedal_estimator")
|
|
797
847
|
|
|
798
|
-
self._check_n_features(X, reset=False)
|
|
799
848
|
if sklearn_check_version("1.0"):
|
|
800
|
-
self.
|
|
849
|
+
X = self._validate_data(
|
|
850
|
+
X,
|
|
851
|
+
dtype=[np.float64, np.float32],
|
|
852
|
+
force_all_finite=False,
|
|
853
|
+
reset=False,
|
|
854
|
+
ensure_2d=True,
|
|
855
|
+
)
|
|
856
|
+
else:
|
|
857
|
+
X = check_array(
|
|
858
|
+
X,
|
|
859
|
+
dtype=[np.float64, np.float32],
|
|
860
|
+
force_all_finite=False,
|
|
861
|
+
) # Warning, order of dtype matters
|
|
862
|
+
self._check_n_features(X, reset=False)
|
|
863
|
+
|
|
801
864
|
return self._onedal_estimator.predict_proba(X, queue=queue)
|
|
802
865
|
|
|
803
866
|
def _onedal_score(self, X, y, sample_weight=None, queue=None):
|
|
@@ -914,7 +977,7 @@ class ForestRegressor(sklearn_ForestRegressor, BaseForest):
|
|
|
914
977
|
)
|
|
915
978
|
|
|
916
979
|
if patching_status.get_status():
|
|
917
|
-
X, y =
|
|
980
|
+
X, y = check_X_y(
|
|
918
981
|
X,
|
|
919
982
|
y,
|
|
920
983
|
multi_output=True,
|
|
@@ -996,7 +1059,7 @@ class ForestRegressor(sklearn_ForestRegressor, BaseForest):
|
|
|
996
1059
|
]
|
|
997
1060
|
)
|
|
998
1061
|
|
|
999
|
-
elif method_name
|
|
1062
|
+
elif method_name in ["predict", "score"]:
|
|
1000
1063
|
X = data[0]
|
|
1001
1064
|
|
|
1002
1065
|
patching_status.and_conditions(
|
|
@@ -1046,11 +1109,12 @@ class ForestRegressor(sklearn_ForestRegressor, BaseForest):
|
|
|
1046
1109
|
or self.estimator.__class__ == DecisionTreeClassifier,
|
|
1047
1110
|
"ExtraTrees only supported starting from oneDAL version 2023.1",
|
|
1048
1111
|
),
|
|
1112
|
+
(not self.oob_score, "oob_score value is not sklearn conformant."),
|
|
1049
1113
|
(sample_weight is None, "sample_weight is not supported."),
|
|
1050
1114
|
]
|
|
1051
1115
|
)
|
|
1052
1116
|
|
|
1053
|
-
elif method_name
|
|
1117
|
+
elif method_name in ["predict", "score"]:
|
|
1054
1118
|
X = data[0]
|
|
1055
1119
|
|
|
1056
1120
|
patching_status.and_conditions(
|
|
@@ -1083,16 +1147,28 @@ class ForestRegressor(sklearn_ForestRegressor, BaseForest):
|
|
|
1083
1147
|
return patching_status
|
|
1084
1148
|
|
|
1085
1149
|
def _onedal_predict(self, X, queue=None):
|
|
1086
|
-
X = check_array(
|
|
1087
|
-
X, dtype=[np.float64, np.float32], force_all_finite=False
|
|
1088
|
-
) # Warning, order of dtype matters
|
|
1089
1150
|
check_is_fitted(self, "_onedal_estimator")
|
|
1090
1151
|
|
|
1091
1152
|
if sklearn_check_version("1.0"):
|
|
1092
|
-
self.
|
|
1153
|
+
X = self._validate_data(
|
|
1154
|
+
X,
|
|
1155
|
+
dtype=[np.float64, np.float32],
|
|
1156
|
+
force_all_finite=False,
|
|
1157
|
+
reset=False,
|
|
1158
|
+
ensure_2d=True,
|
|
1159
|
+
) # Warning, order of dtype matters
|
|
1160
|
+
else:
|
|
1161
|
+
X = check_array(
|
|
1162
|
+
X, dtype=[np.float64, np.float32], force_all_finite=False
|
|
1163
|
+
) # Warning, order of dtype matters
|
|
1093
1164
|
|
|
1094
1165
|
return self._onedal_estimator.predict(X, queue=queue)
|
|
1095
1166
|
|
|
1167
|
+
def _onedal_score(self, X, y, sample_weight=None, queue=None):
|
|
1168
|
+
return r2_score(
|
|
1169
|
+
y, self._onedal_predict(X, queue=queue), sample_weight=sample_weight
|
|
1170
|
+
)
|
|
1171
|
+
|
|
1096
1172
|
def fit(self, X, y, sample_weight=None):
|
|
1097
1173
|
dispatch(
|
|
1098
1174
|
self,
|
|
@@ -1119,8 +1195,23 @@ class ForestRegressor(sklearn_ForestRegressor, BaseForest):
|
|
|
1119
1195
|
X,
|
|
1120
1196
|
)
|
|
1121
1197
|
|
|
1198
|
+
@wrap_output_data
|
|
1199
|
+
def score(self, X, y, sample_weight=None):
|
|
1200
|
+
return dispatch(
|
|
1201
|
+
self,
|
|
1202
|
+
"score",
|
|
1203
|
+
{
|
|
1204
|
+
"onedal": self.__class__._onedal_score,
|
|
1205
|
+
"sklearn": sklearn_ForestRegressor.score,
|
|
1206
|
+
},
|
|
1207
|
+
X,
|
|
1208
|
+
y,
|
|
1209
|
+
sample_weight=sample_weight,
|
|
1210
|
+
)
|
|
1211
|
+
|
|
1122
1212
|
fit.__doc__ = sklearn_ForestRegressor.fit.__doc__
|
|
1123
1213
|
predict.__doc__ = sklearn_ForestRegressor.predict.__doc__
|
|
1214
|
+
score.__doc__ = sklearn_ForestRegressor.score.__doc__
|
|
1124
1215
|
|
|
1125
1216
|
|
|
1126
1217
|
@control_n_jobs(decorated_methods=["fit", "predict", "predict_proba", "score"])
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
# ===============================================================================
|
|
16
16
|
|
|
17
|
+
import numpy as np
|
|
17
18
|
import pytest
|
|
18
19
|
from numpy.testing import assert_allclose
|
|
19
20
|
from sklearn.datasets import make_classification, make_regression
|
|
@@ -45,7 +46,10 @@ def test_sklearnex_import_rf_classifier(dataframe, queue):
|
|
|
45
46
|
assert_allclose([1], _as_numpy(rf.predict([[0, 0, 0, 0]])))
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
# TODO: fix RF regressor predict for the GPU sycl_queue.
|
|
50
|
+
@pytest.mark.parametrize(
|
|
51
|
+
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
52
|
+
)
|
|
49
53
|
def test_sklearnex_import_rf_regression(dataframe, queue):
|
|
50
54
|
from sklearnex.ensemble import RandomForestRegressor
|
|
51
55
|
|
|
@@ -65,7 +69,10 @@ def test_sklearnex_import_rf_regression(dataframe, queue):
|
|
|
65
69
|
assert_allclose([-6.839], pred, atol=1e-2)
|
|
66
70
|
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
# TODO: fix ET classifier predict for the GPU sycl_queue.
|
|
73
|
+
@pytest.mark.parametrize(
|
|
74
|
+
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
75
|
+
)
|
|
69
76
|
def test_sklearnex_import_et_classifier(dataframe, queue):
|
|
70
77
|
from sklearnex.ensemble import ExtraTreesClassifier
|
|
71
78
|
|
|
@@ -86,7 +93,10 @@ def test_sklearnex_import_et_classifier(dataframe, queue):
|
|
|
86
93
|
assert_allclose([1], _as_numpy(rf.predict([[0, 0, 0, 0]])))
|
|
87
94
|
|
|
88
95
|
|
|
89
|
-
|
|
96
|
+
# TODO: fix ET regressor predict for the GPU sycl_queue.
|
|
97
|
+
@pytest.mark.parametrize(
|
|
98
|
+
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
99
|
+
)
|
|
90
100
|
def test_sklearnex_import_et_regression(dataframe, queue):
|
|
91
101
|
from sklearnex.ensemble import ExtraTreesRegressor
|
|
92
102
|
|
sklearnex/glob/dispatcher.py
CHANGED
|
@@ -17,18 +17,32 @@
|
|
|
17
17
|
|
|
18
18
|
def get_patch_str(name=None, verbose=True):
|
|
19
19
|
return f"""try:
|
|
20
|
+
# TEMP. FIX: sklearnex.patch_sklearn imports sklearn beforehand
|
|
21
|
+
# when it didn't initialized _threadpool_controller required for
|
|
22
|
+
# pairwise distances dispatching during imports.
|
|
23
|
+
# Manually setting and deleting _threadpool_controller during patch fixes it.
|
|
24
|
+
import sklearn
|
|
25
|
+
from threadpoolctl import ThreadpoolController
|
|
26
|
+
sklearn._threadpool_controller = ThreadpoolController()
|
|
20
27
|
from sklearnex import patch_sklearn
|
|
21
28
|
patch_sklearn(name={str(name)}, verbose={str(verbose)})
|
|
22
|
-
del patch_sklearn
|
|
29
|
+
del patch_sklearn, sklearn._threadpool_controller
|
|
23
30
|
except ImportError:
|
|
24
31
|
pass"""
|
|
25
32
|
|
|
26
33
|
|
|
27
34
|
def get_patch_str_re():
|
|
28
35
|
return r"""\ntry:
|
|
36
|
+
\# TEMP. FIX: sklearnex.patch_sklearn imports sklearn beforehand
|
|
37
|
+
\# when it didn't initialized _threadpool_controller required for
|
|
38
|
+
\# pairwise distances dispatching during imports.
|
|
39
|
+
\# Manually setting and deleting _threadpool_controller during patch fixes it.
|
|
40
|
+
import sklearn
|
|
41
|
+
from threadpoolctl import ThreadpoolController
|
|
42
|
+
sklearn._threadpool_controller = ThreadpoolController\(\)
|
|
29
43
|
from sklearnex import patch_sklearn
|
|
30
44
|
patch_sklearn\(name=.*, verbose=.*\)
|
|
31
|
-
del patch_sklearn
|
|
45
|
+
del patch_sklearn, sklearn._threadpool_controller
|
|
32
46
|
except ImportError:
|
|
33
47
|
pass\n"""
|
|
34
48
|
|