scikit-learn-intelex 2024.4.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.4.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/METADATA +2 -2
- {scikit_learn_intelex-2024.4.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/RECORD +43 -36
- sklearnex/_device_offload.py +8 -1
- sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +2 -4
- sklearnex/cluster/dbscan.py +3 -0
- sklearnex/cluster/tests/test_dbscan.py +8 -6
- sklearnex/conftest.py +11 -1
- sklearnex/covariance/incremental_covariance.py +217 -30
- sklearnex/covariance/tests/test_incremental_covariance.py +54 -17
- sklearnex/decomposition/pca.py +68 -13
- sklearnex/decomposition/tests/test_pca.py +6 -4
- sklearnex/dispatcher.py +46 -1
- sklearnex/ensemble/_forest.py +114 -22
- sklearnex/ensemble/tests/test_forest.py +13 -3
- sklearnex/glob/dispatcher.py +16 -2
- sklearnex/linear_model/__init__.py +5 -3
- sklearnex/linear_model/incremental_linear.py +464 -0
- sklearnex/linear_model/linear.py +27 -9
- sklearnex/linear_model/logistic_regression.py +13 -15
- sklearnex/linear_model/tests/test_incremental_linear.py +200 -0
- sklearnex/linear_model/tests/test_linear.py +2 -2
- sklearnex/neighbors/knn_regression.py +24 -0
- sklearnex/neighbors/tests/test_neighbors.py +2 -2
- 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 +70 -29
- sklearnex/tests/test_common.py +54 -0
- sklearnex/tests/test_memory_usage.py +195 -132
- sklearnex/tests/test_n_jobs_support.py +4 -0
- sklearnex/tests/test_patching.py +22 -10
- sklearnex/tests/test_run_to_run_stability.py +283 -0
- sklearnex/utils/_namespace.py +1 -1
- sklearnex/utils/tests/test_finite.py +89 -0
- sklearnex/tests/test_run_to_run_stability_tests.py +0 -428
- {scikit_learn_intelex-2024.4.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/LICENSE.txt +0 -0
- {scikit_learn_intelex-2024.4.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/WHEEL +0 -0
- {scikit_learn_intelex-2024.4.0.dist-info → scikit_learn_intelex-2024.6.0.dist-info}/top_level.txt +0 -0
{scikit_learn_intelex-2024.4.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
|
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
sklearnex/__init__.py,sha256=DVpGCMMQcUlrOGj_iy1jk3ZhCfa0_TFISYLqaUDRqC0,1780
|
|
2
2
|
sklearnex/__main__.py,sha256=Le9BJq6aLEGSSoZwJLsOADxsV89ynBfA8BcoJHk9F24,1921
|
|
3
3
|
sklearnex/_config.py,sha256=6WS3UuS4-0DxIJyGn7yQMosj-mGkLybLQrg3W7dED5o,3928
|
|
4
|
-
sklearnex/_device_offload.py,sha256=
|
|
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
|
-
sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py,sha256=
|
|
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
|
-
sklearnex/covariance/incremental_covariance.py,sha256=
|
|
19
|
-
sklearnex/covariance/tests/test_incremental_covariance.py,sha256=
|
|
18
|
+
sklearnex/covariance/incremental_covariance.py,sha256=0MvYlGnmuZ8_kRBaIkMzg3RyGdcSMjO-I7dhw2VpTsg,11010
|
|
19
|
+
sklearnex/covariance/tests/test_incremental_covariance.py,sha256=ZbEfup4ICm278RW4hZIHPciOiqhFhx_k1l3lpnw0M6s,6763
|
|
20
20
|
sklearnex/decomposition/__init__.py,sha256=RJBYDWyvnn5DA-j5r4IqVdXLp6H4mdPySsSjnXhlv-U,805
|
|
21
|
-
sklearnex/decomposition/pca.py,sha256=
|
|
22
|
-
sklearnex/decomposition/tests/test_pca.py,sha256=
|
|
21
|
+
sklearnex/decomposition/pca.py,sha256=JkyxsSz_8vVGUjJrfxyAwwY1Yf2uht-qxwOisEHv9mY,15550
|
|
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=
|
|
29
|
-
sklearnex/linear_model/__init__.py,sha256=
|
|
28
|
+
sklearnex/glob/dispatcher.py,sha256=o6XKGKM3M91F7FlXBOt1IhnpWQK4R1VY2WS-0uIghcw,3906
|
|
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/
|
|
31
|
+
sklearnex/linear_model/incremental_linear.py,sha256=iDad4Z4xMDImvG-Jgtt0Hz3Qp9MVhSi-IjUPcV0Y_ks,16101
|
|
32
|
+
sklearnex/linear_model/linear.py,sha256=SUoFFvpl4Eb308sYBp6FNbZls-4G69eg8wSeuPs0oAg,11765
|
|
32
33
|
sklearnex/linear_model/logistic_path.py,sha256=Nq3JPXSzE4bjamnP3gGQtsMKks2v7s6bSiuYRnFqrRw,849
|
|
33
|
-
sklearnex/linear_model/logistic_regression.py,sha256=
|
|
34
|
+
sklearnex/linear_model/logistic_regression.py,sha256=jmsNs7MYHm-PncuG20m_TSqXbM5jXx_vHsoH-hReEFQ,14271
|
|
34
35
|
sklearnex/linear_model/ridge.py,sha256=0oxlM5McYYvl0KxK9OIGJKM6lOADuFSPTdfx-efJNTI,810
|
|
35
|
-
sklearnex/linear_model/tests/
|
|
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
|
|
36
38
|
sklearnex/linear_model/tests/test_logreg.py,sha256=mUYDwTDUekERlzxjnVeOeCUcNv4KJAXdTIiELZNSaDc,3283
|
|
37
39
|
sklearnex/manifold/__init__.py,sha256=3FU5fY1YvHAyNeSlUHsZfPnAbvlAUtZpum0Obmok2KE,809
|
|
38
40
|
sklearnex/manifold/t_sne.py,sha256=U6F_dGB6taVuEJvTnVBWD-sri3x3m0Khu3HI4wXidhg,805
|
|
@@ -48,16 +50,19 @@ sklearnex/neighbors/__init__.py,sha256=_GMJ2L-6YechRYI2fOFwHjy0kebUncE81z4FmdXUl
|
|
|
48
50
|
sklearnex/neighbors/_lof.py,sha256=5MPkWIb6FS55Q8xWzgc22Ec_PsouuN94SPovt-vsBGE,8648
|
|
49
51
|
sklearnex/neighbors/common.py,sha256=8DxDoYtXtEM4RNoMCimpTVSDOOxUIJlNVOQvBXBhkd4,10875
|
|
50
52
|
sklearnex/neighbors/knn_classification.py,sha256=ONoBbtwb5xoVLcpg5COpRNu1ZBOQ2EDh03RzbWDy5yo,8537
|
|
51
|
-
sklearnex/neighbors/knn_regression.py,sha256=
|
|
53
|
+
sklearnex/neighbors/knn_regression.py,sha256=ge8VAMa8aJ58M5ccN5NMILFHuRYtYKzyoLF8fxxgGfo,7462
|
|
52
54
|
sklearnex/neighbors/knn_unsupervised.py,sha256=qkj-hSEq8QetYsWlofnik3PpFvo1iBUbIOhywo8wFWk,5362
|
|
53
|
-
sklearnex/neighbors/tests/test_neighbors.py,sha256=
|
|
54
|
-
sklearnex/preview/__init__.py,sha256=
|
|
55
|
+
sklearnex/neighbors/tests/test_neighbors.py,sha256=yAlMnLt9GrdT6Ceph5B7iFuMJXpDURiHWTE99oO8EDw,3417
|
|
56
|
+
sklearnex/preview/__init__.py,sha256=1QcbV6xCSP7QCXRxYLVPc_b4lxE0cQiyTrMm4xOnosM,797
|
|
55
57
|
sklearnex/preview/cluster/__init__.py,sha256=FONzOuTGAb5NwdfFhLco99P_VccRk9NBkDHU3EKuAIs,794
|
|
56
58
|
sklearnex/preview/cluster/_common.py,sha256=bgpzijxgyrAtdNCCHyCNsZ-N70KQYNwMuoCTNdUna6o,2718
|
|
57
59
|
sklearnex/preview/cluster/k_means.py,sha256=RdF9mwgvZ1xgyeLhCQA2WaPvPsS1ndktXXcaNj6S460,10464
|
|
58
60
|
sklearnex/preview/covariance/__init__.py,sha256=DPYTk8lwcVphtwU8J3CyUYH8Uz6Zr0Uz4S6nn-RY5iM,825
|
|
59
61
|
sklearnex/preview/covariance/covariance.py,sha256=NjRTWLie7UbpfN16wGSxJSRHRhUnvTn03cPPc8PpPd8,5131
|
|
60
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
|
|
61
66
|
sklearnex/spmd/__init__.py,sha256=ChQy2kEWlo4KGvs0RnbPoPEVhdgl8URV099B1rZtF5Y,889
|
|
62
67
|
sklearnex/spmd/basic_statistics/__init__.py,sha256=NA5RGlwcp27UEeCgz0ngzYYd3MAIRpxlTy86uhM2-RE,821
|
|
63
68
|
sklearnex/spmd/basic_statistics/basic_statistics.py,sha256=_dQ9mhVYxeuChATEpAmHpXDpgW3YvtK1qrG-kLr2MtI,886
|
|
@@ -76,26 +81,28 @@ sklearnex/spmd/linear_model/logistic_regression.py,sha256=q_HkfWcg0RgFbk2t9FeV0Z
|
|
|
76
81
|
sklearnex/spmd/neighbors/__init__.py,sha256=S16sH8N_18LN_8AgC_wGK5EDSNyuN-F-gI6GVlaiWVE,906
|
|
77
82
|
sklearnex/spmd/neighbors/neighbors.py,sha256=SiKAS_RVt34MUcGytBS5pHnI_5vFNxJn8jqt1MOhDh8,940
|
|
78
83
|
sklearnex/svm/__init__.py,sha256=f3e4ZFwZfx6MsXsn94VK1xVm6mWKT5XCiHczo6zNyAQ,1057
|
|
79
|
-
sklearnex/svm/_common.py,sha256=
|
|
80
|
-
sklearnex/svm/nusvc.py,sha256
|
|
81
|
-
sklearnex/svm/nusvr.py,sha256=
|
|
82
|
-
sklearnex/svm/svc.py,sha256=
|
|
83
|
-
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
|
|
84
89
|
sklearnex/svm/tests/test_svm.py,sha256=Ru-aGNGCsRJts7SEEYbnKcVqUx-DqPyUtw-hEoMVpW8,4190
|
|
85
|
-
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
|
|
86
92
|
sklearnex/tests/test_config.py,sha256=SnSJjxAAysISDyC3bYKSJiRHStkB9X-yjLeF11LpRog,1372
|
|
87
|
-
sklearnex/tests/test_memory_usage.py,sha256=
|
|
93
|
+
sklearnex/tests/test_memory_usage.py,sha256=FTtQgaa7p5ScDGscB93LkpU4B3DzfqnVMi84b2vSL30,10957
|
|
88
94
|
sklearnex/tests/test_monkeypatch.py,sha256=_9s_4jFvbttOf8uCuBrS4rn_AzQdFlKyRlthnGacUcU,9669
|
|
89
|
-
sklearnex/tests/test_n_jobs_support.py,sha256=
|
|
95
|
+
sklearnex/tests/test_n_jobs_support.py,sha256=NziTP4GwZEDoBe1CDvhHZnp8JpwjYQmCNvXEDfS7Wo4,4313
|
|
90
96
|
sklearnex/tests/test_parallel.py,sha256=0zzlh2VJZWcHw5W4QSUthtAygOb6K0Bg1ekNsrdGJQE,1770
|
|
91
|
-
sklearnex/tests/test_patching.py,sha256=
|
|
92
|
-
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
|
|
93
99
|
sklearnex/utils/__init__.py,sha256=FFlM8zc2qnSdPYpLjSt4Ma_9FjC8qk8wXJa-5B8hCs0,898
|
|
94
|
-
sklearnex/utils/_namespace.py,sha256=
|
|
100
|
+
sklearnex/utils/_namespace.py,sha256=ohr8gOgEFgrccLecllMVYQPqbqqyye9uT-cWLtyxHFs,3167
|
|
95
101
|
sklearnex/utils/parallel.py,sha256=VBcS-KUdyq7XpJUN6ygmNjyWtYLroghbvCxQ8nVU3YI,2085
|
|
96
102
|
sklearnex/utils/validation.py,sha256=fjfhQiKnBQnD7LCBlacMyvsrhGnlMLRXk5Q69uoZIP4,827
|
|
97
|
-
|
|
98
|
-
scikit_learn_intelex-2024.
|
|
99
|
-
scikit_learn_intelex-2024.
|
|
100
|
-
scikit_learn_intelex-2024.
|
|
101
|
-
scikit_learn_intelex-2024.
|
|
103
|
+
sklearnex/utils/tests/test_finite.py,sha256=AzJRY71X0VvDUicUI8Ey9Le6_yKp5O-3ZikhDVJNWms,2943
|
|
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/_device_offload.py
CHANGED
|
@@ -127,8 +127,15 @@ def _transfer_to_host(queue, *data):
|
|
|
127
127
|
queue = usm_iface["syclobj"]
|
|
128
128
|
|
|
129
129
|
buffer = as_usm_memory(item).copy_to_host()
|
|
130
|
+
order = "C"
|
|
131
|
+
if usm_iface["strides"] is not None:
|
|
132
|
+
if usm_iface["strides"][0] < usm_iface["strides"][1]:
|
|
133
|
+
order = "F"
|
|
130
134
|
item = np.ndarray(
|
|
131
|
-
shape=usm_iface["shape"],
|
|
135
|
+
shape=usm_iface["shape"],
|
|
136
|
+
dtype=usm_iface["typestr"],
|
|
137
|
+
buffer=buffer,
|
|
138
|
+
order=order,
|
|
132
139
|
)
|
|
133
140
|
has_usm_data = True
|
|
134
141
|
else:
|
|
@@ -165,7 +165,7 @@ def test_partial_fit_multiple_options_on_random_data(
|
|
|
165
165
|
expected_sum(X),
|
|
166
166
|
)
|
|
167
167
|
|
|
168
|
-
tol =
|
|
168
|
+
tol = 3e-4 if res_mean.dtype == np.float32 else 1e-7
|
|
169
169
|
assert_allclose(gtr_mean, res_mean, atol=tol)
|
|
170
170
|
assert_allclose(gtr_max, res_max, atol=tol)
|
|
171
171
|
assert_allclose(gtr_sum, res_sum, atol=tol)
|
|
@@ -208,7 +208,6 @@ def test_partial_fit_all_option_on_random_data(
|
|
|
208
208
|
|
|
209
209
|
for option in options_and_tests:
|
|
210
210
|
result_option, function, tols = option
|
|
211
|
-
print(result_option)
|
|
212
211
|
fp32tol, fp64tol = tols
|
|
213
212
|
res = getattr(result, result_option)
|
|
214
213
|
if weighted:
|
|
@@ -301,7 +300,7 @@ def test_fit_single_option_on_random_data(
|
|
|
301
300
|
@pytest.mark.parametrize("column_count", [10, 100])
|
|
302
301
|
@pytest.mark.parametrize("weighted", [True, False])
|
|
303
302
|
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
304
|
-
def
|
|
303
|
+
def test_fit_multiple_options_on_random_data(
|
|
305
304
|
dataframe, queue, num_batches, row_count, column_count, weighted, dtype
|
|
306
305
|
):
|
|
307
306
|
seed = 77
|
|
@@ -375,7 +374,6 @@ def test_fit_all_option_on_random_data(
|
|
|
375
374
|
|
|
376
375
|
for option in options_and_tests:
|
|
377
376
|
result_option, function, tols = option
|
|
378
|
-
print(result_option)
|
|
379
377
|
fp32tol, fp64tol = tols
|
|
380
378
|
res = getattr(result, result_option)
|
|
381
379
|
if weighted:
|
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
|
|
@@ -14,18 +14,33 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
# ===============================================================================
|
|
16
16
|
|
|
17
|
+
import numbers
|
|
18
|
+
import warnings
|
|
19
|
+
|
|
17
20
|
import numpy as np
|
|
21
|
+
from scipy import linalg
|
|
22
|
+
from sklearn.base import BaseEstimator
|
|
23
|
+
from sklearn.covariance import EmpiricalCovariance as sklearn_EmpiricalCovariance
|
|
18
24
|
from sklearn.utils import check_array, gen_batches
|
|
19
25
|
|
|
20
26
|
from daal4py.sklearn._n_jobs_support import control_n_jobs
|
|
27
|
+
from daal4py.sklearn._utils import daal_check_version, sklearn_check_version
|
|
21
28
|
from onedal._device_offload import support_usm_ndarray
|
|
22
29
|
from onedal.covariance import (
|
|
23
30
|
IncrementalEmpiricalCovariance as onedal_IncrementalEmpiricalCovariance,
|
|
24
31
|
)
|
|
32
|
+
from sklearnex import config_context
|
|
33
|
+
|
|
34
|
+
from .._device_offload import dispatch, wrap_output_data
|
|
35
|
+
from .._utils import PatchingConditionsChain, register_hyperparameters
|
|
36
|
+
from ..metrics import pairwise_distances
|
|
25
37
|
|
|
38
|
+
if sklearn_check_version("1.2"):
|
|
39
|
+
from sklearn.utils._param_validation import Interval
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
|
|
42
|
+
@control_n_jobs(decorated_methods=["partial_fit", "fit", "_onedal_finalize_fit"])
|
|
43
|
+
class IncrementalEmpiricalCovariance(BaseEstimator):
|
|
29
44
|
"""
|
|
30
45
|
Incremental estimator for covariance.
|
|
31
46
|
Allows to compute empirical covariance estimated by maximum
|
|
@@ -33,12 +48,25 @@ class IncrementalEmpiricalCovariance:
|
|
|
33
48
|
|
|
34
49
|
Parameters
|
|
35
50
|
----------
|
|
51
|
+
store_precision : bool, default=False
|
|
52
|
+
Specifies if the estimated precision is stored.
|
|
53
|
+
|
|
54
|
+
assume_centered : bool, default=False
|
|
55
|
+
If True, data are not centered before computation.
|
|
56
|
+
Useful when working with data whose mean is almost, but not exactly
|
|
57
|
+
zero.
|
|
58
|
+
If False (default), data are centered before computation.
|
|
59
|
+
|
|
36
60
|
batch_size : int, default=None
|
|
37
61
|
The number of samples to use for each batch. Only used when calling
|
|
38
62
|
``fit``. If ``batch_size`` is ``None``, then ``batch_size``
|
|
39
63
|
is inferred from the data and set to ``5 * n_features``, to provide a
|
|
40
64
|
balance between approximation accuracy and memory consumption.
|
|
41
65
|
|
|
66
|
+
copy : bool, default=True
|
|
67
|
+
If False, X will be overwritten. ``copy=False`` can be used to
|
|
68
|
+
save memory but is unsafe for general use.
|
|
69
|
+
|
|
42
70
|
Attributes
|
|
43
71
|
----------
|
|
44
72
|
location_ : ndarray of shape (n_features,)
|
|
@@ -46,44 +74,130 @@ class IncrementalEmpiricalCovariance:
|
|
|
46
74
|
|
|
47
75
|
covariance_ : ndarray of shape (n_features, n_features)
|
|
48
76
|
Estimated covariance matrix
|
|
77
|
+
|
|
78
|
+
n_samples_seen_ : int
|
|
79
|
+
The number of samples processed by the estimator. Will be reset on
|
|
80
|
+
new calls to fit, but increments across ``partial_fit`` calls.
|
|
81
|
+
|
|
82
|
+
batch_size_ : int
|
|
83
|
+
Inferred batch size from ``batch_size``.
|
|
84
|
+
|
|
85
|
+
n_features_in_ : int
|
|
86
|
+
Number of features seen during :term:`fit` `partial_fit`.
|
|
49
87
|
"""
|
|
50
88
|
|
|
51
89
|
_onedal_incremental_covariance = staticmethod(onedal_IncrementalEmpiricalCovariance)
|
|
52
90
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
91
|
+
if sklearn_check_version("1.2"):
|
|
92
|
+
_parameter_constraints: dict = {
|
|
93
|
+
"store_precision": ["boolean"],
|
|
94
|
+
"assume_centered": ["boolean"],
|
|
95
|
+
"batch_size": [Interval(numbers.Integral, 1, None, closed="left"), None],
|
|
96
|
+
"copy": ["boolean"],
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get_precision = sklearn_EmpiricalCovariance.get_precision
|
|
100
|
+
error_norm = wrap_output_data(sklearn_EmpiricalCovariance.error_norm)
|
|
101
|
+
score = wrap_output_data(sklearn_EmpiricalCovariance.score)
|
|
102
|
+
|
|
103
|
+
def __init__(
|
|
104
|
+
self, *, store_precision=False, assume_centered=False, batch_size=None, copy=True
|
|
105
|
+
):
|
|
106
|
+
self.assume_centered = assume_centered
|
|
107
|
+
self.store_precision = store_precision
|
|
56
108
|
self.batch_size = batch_size
|
|
109
|
+
self.copy = copy
|
|
110
|
+
|
|
111
|
+
def _onedal_supported(self, method_name, *data):
|
|
112
|
+
patching_status = PatchingConditionsChain(
|
|
113
|
+
f"sklearn.covariance.{self.__class__.__name__}.{method_name}"
|
|
114
|
+
)
|
|
115
|
+
return patching_status
|
|
57
116
|
|
|
58
117
|
def _onedal_finalize_fit(self):
|
|
59
118
|
assert hasattr(self, "_onedal_estimator")
|
|
60
119
|
self._onedal_estimator.finalize_fit()
|
|
61
120
|
self._need_to_finalize = False
|
|
62
121
|
|
|
63
|
-
|
|
122
|
+
if not daal_check_version((2024, "P", 400)) and self.assume_centered:
|
|
123
|
+
location = self._onedal_estimator.location_[None, :]
|
|
124
|
+
self._onedal_estimator.covariance_ += np.dot(location.T, location)
|
|
125
|
+
self._onedal_estimator.location_ = np.zeros_like(np.squeeze(location))
|
|
126
|
+
if self.store_precision:
|
|
127
|
+
self.precision_ = linalg.pinvh(
|
|
128
|
+
self._onedal_estimator.covariance_, check_finite=False
|
|
129
|
+
)
|
|
130
|
+
else:
|
|
131
|
+
self.precision_ = None
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def covariance_(self):
|
|
135
|
+
if hasattr(self, "_onedal_estimator"):
|
|
136
|
+
if self._need_to_finalize:
|
|
137
|
+
self._onedal_finalize_fit()
|
|
138
|
+
return self._onedal_estimator.covariance_
|
|
139
|
+
else:
|
|
140
|
+
raise AttributeError(
|
|
141
|
+
f"'{self.__class__.__name__}' object has no attribute 'covariance_'"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def location_(self):
|
|
146
|
+
if hasattr(self, "_onedal_estimator"):
|
|
147
|
+
if self._need_to_finalize:
|
|
148
|
+
self._onedal_finalize_fit()
|
|
149
|
+
return self._onedal_estimator.location_
|
|
150
|
+
else:
|
|
151
|
+
raise AttributeError(
|
|
152
|
+
f"'{self.__class__.__name__}' object has no attribute 'location_'"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
def _onedal_partial_fit(self, X, queue=None, check_input=True):
|
|
156
|
+
|
|
157
|
+
first_pass = not hasattr(self, "n_samples_seen_") or self.n_samples_seen_ == 0
|
|
158
|
+
|
|
159
|
+
# finite check occurs on onedal side
|
|
160
|
+
if check_input:
|
|
161
|
+
if sklearn_check_version("1.2"):
|
|
162
|
+
self._validate_params()
|
|
163
|
+
|
|
164
|
+
if sklearn_check_version("1.0"):
|
|
165
|
+
X = self._validate_data(
|
|
166
|
+
X,
|
|
167
|
+
dtype=[np.float64, np.float32],
|
|
168
|
+
reset=first_pass,
|
|
169
|
+
copy=self.copy,
|
|
170
|
+
force_all_finite=False,
|
|
171
|
+
)
|
|
172
|
+
else:
|
|
173
|
+
X = check_array(
|
|
174
|
+
X,
|
|
175
|
+
dtype=[np.float64, np.float32],
|
|
176
|
+
copy=self.copy,
|
|
177
|
+
force_all_finite=False,
|
|
178
|
+
)
|
|
179
|
+
|
|
64
180
|
onedal_params = {
|
|
65
181
|
"method": "dense",
|
|
66
182
|
"bias": True,
|
|
183
|
+
"assume_centered": self.assume_centered,
|
|
67
184
|
}
|
|
68
185
|
if not hasattr(self, "_onedal_estimator"):
|
|
69
186
|
self._onedal_estimator = self._onedal_incremental_covariance(**onedal_params)
|
|
70
|
-
|
|
71
|
-
|
|
187
|
+
try:
|
|
188
|
+
if first_pass:
|
|
189
|
+
self.n_samples_seen_ = X.shape[0]
|
|
190
|
+
self.n_features_in_ = X.shape[1]
|
|
191
|
+
else:
|
|
192
|
+
self.n_samples_seen_ += X.shape[0]
|
|
72
193
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
self._onedal_finalize_fit()
|
|
77
|
-
return self._onedal_estimator.covariance_
|
|
194
|
+
self._onedal_estimator.partial_fit(X, queue)
|
|
195
|
+
finally:
|
|
196
|
+
self._need_to_finalize = True
|
|
78
197
|
|
|
79
|
-
|
|
80
|
-
def location_(self):
|
|
81
|
-
if self._need_to_finalize:
|
|
82
|
-
self._onedal_finalize_fit()
|
|
83
|
-
return self._onedal_estimator.location_
|
|
198
|
+
return self
|
|
84
199
|
|
|
85
|
-
|
|
86
|
-
def partial_fit(self, X, queue=None):
|
|
200
|
+
def partial_fit(self, X, y=None, check_input=True):
|
|
87
201
|
"""
|
|
88
202
|
Incremental fit with X. All of X is processed as a single batch.
|
|
89
203
|
|
|
@@ -93,16 +207,29 @@ class IncrementalEmpiricalCovariance:
|
|
|
93
207
|
Training data, where `n_samples` is the number of samples and
|
|
94
208
|
`n_features` is the number of features.
|
|
95
209
|
|
|
210
|
+
y : Ignored
|
|
211
|
+
Not used, present for API consistency by convention.
|
|
212
|
+
|
|
213
|
+
check_input : bool, default=True
|
|
214
|
+
Run check_array on X.
|
|
215
|
+
|
|
96
216
|
Returns
|
|
97
217
|
-------
|
|
98
218
|
self : object
|
|
99
219
|
Returns the instance itself.
|
|
100
220
|
"""
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
221
|
+
return dispatch(
|
|
222
|
+
self,
|
|
223
|
+
"partial_fit",
|
|
224
|
+
{
|
|
225
|
+
"onedal": self.__class__._onedal_partial_fit,
|
|
226
|
+
"sklearn": None,
|
|
227
|
+
},
|
|
228
|
+
X,
|
|
229
|
+
check_input=check_input,
|
|
230
|
+
)
|
|
104
231
|
|
|
105
|
-
def fit(self, X,
|
|
232
|
+
def fit(self, X, y=None):
|
|
106
233
|
"""
|
|
107
234
|
Fit the model with X, using minibatches of size batch_size.
|
|
108
235
|
|
|
@@ -112,19 +239,79 @@ class IncrementalEmpiricalCovariance:
|
|
|
112
239
|
Training data, where `n_samples` is the number of samples and
|
|
113
240
|
`n_features` is the number of features.
|
|
114
241
|
|
|
242
|
+
y : Ignored
|
|
243
|
+
Not used, present for API consistency by convention.
|
|
244
|
+
|
|
115
245
|
Returns
|
|
116
246
|
-------
|
|
117
247
|
self : object
|
|
118
248
|
Returns the instance itself.
|
|
119
249
|
"""
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
250
|
+
|
|
251
|
+
return dispatch(
|
|
252
|
+
self,
|
|
253
|
+
"fit",
|
|
254
|
+
{
|
|
255
|
+
"onedal": self.__class__._onedal_fit,
|
|
256
|
+
"sklearn": None,
|
|
257
|
+
},
|
|
258
|
+
X,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def _onedal_fit(self, X, queue=None):
|
|
262
|
+
self.n_samples_seen_ = 0
|
|
263
|
+
if hasattr(self, "_onedal_estimator"):
|
|
264
|
+
self._onedal_estimator._reset()
|
|
265
|
+
|
|
266
|
+
if sklearn_check_version("1.2"):
|
|
267
|
+
self._validate_params()
|
|
268
|
+
|
|
269
|
+
# finite check occurs on onedal side
|
|
270
|
+
if sklearn_check_version("1.0"):
|
|
271
|
+
X = self._validate_data(
|
|
272
|
+
X, dtype=[np.float64, np.float32], copy=self.copy, force_all_finite=False
|
|
273
|
+
)
|
|
123
274
|
else:
|
|
124
|
-
|
|
125
|
-
|
|
275
|
+
X = check_array(
|
|
276
|
+
X, dtype=[np.float64, np.float32], copy=self.copy, force_all_finite=False
|
|
277
|
+
)
|
|
278
|
+
self.n_features_in_ = X.shape[1]
|
|
279
|
+
|
|
280
|
+
self.batch_size_ = self.batch_size if self.batch_size else 5 * self.n_features_in_
|
|
281
|
+
|
|
282
|
+
if X.shape[0] == 1:
|
|
283
|
+
warnings.warn(
|
|
284
|
+
"Only one sample available. You may want to reshape your data array"
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
for batch in gen_batches(X.shape[0], self.batch_size_):
|
|
126
288
|
X_batch = X[batch]
|
|
127
|
-
self.
|
|
289
|
+
self._onedal_partial_fit(X_batch, queue=queue, check_input=False)
|
|
128
290
|
|
|
129
291
|
self._onedal_finalize_fit()
|
|
292
|
+
|
|
130
293
|
return self
|
|
294
|
+
|
|
295
|
+
# expose sklearnex pairwise_distances if mahalanobis distance eventually supported
|
|
296
|
+
@wrap_output_data
|
|
297
|
+
def mahalanobis(self, X):
|
|
298
|
+
if sklearn_check_version("1.0"):
|
|
299
|
+
self._validate_data(X, reset=False, copy=self.copy)
|
|
300
|
+
else:
|
|
301
|
+
check_array(X, copy=self.copy)
|
|
302
|
+
|
|
303
|
+
precision = self.get_precision()
|
|
304
|
+
with config_context(assume_finite=True):
|
|
305
|
+
# compute mahalanobis distances
|
|
306
|
+
dist = pairwise_distances(
|
|
307
|
+
X, self.location_[np.newaxis, :], metric="mahalanobis", VI=precision
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
return np.reshape(dist, (len(X),)) ** 2
|
|
311
|
+
|
|
312
|
+
_onedal_cpu_supported = _onedal_supported
|
|
313
|
+
_onedal_gpu_supported = _onedal_supported
|
|
314
|
+
|
|
315
|
+
mahalanobis.__doc__ = sklearn_EmpiricalCovariance.mahalanobis.__doc__
|
|
316
|
+
error_norm.__doc__ = sklearn_EmpiricalCovariance.error_norm.__doc__
|
|
317
|
+
score.__doc__ = sklearn_EmpiricalCovariance.score.__doc__
|