scikit-learn-intelex 2024.1.0__py312-none-win_amd64.whl → 2025.1.0__py312-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.

Files changed (277) hide show
  1. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
  2. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
  3. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/_daal4py.cp312-win_amd64.pyd +0 -0
  4. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/doc/third-party-programs.txt +424 -0
  5. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +19 -0
  6. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mb/model_builders.py +377 -0
  7. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp312-win_amd64.pyd +0 -0
  8. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
  9. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +248 -0
  10. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
  11. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
  12. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
  13. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +597 -0
  14. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
  15. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition}/__init__.py +3 -3
  16. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +524 -0
  17. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +196 -0
  18. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +337 -0
  19. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
  20. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1397 -0
  21. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
  22. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn}/linear_model/__init__.py +29 -29
  23. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +848 -0
  24. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +272 -0
  25. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +325 -0
  26. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +2 -2
  27. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
  28. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
  29. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +1026 -0
  30. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
  31. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +208 -0
  32. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
  33. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/manifold}/__init__.py +4 -2
  34. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +405 -0
  35. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
  36. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +236 -0
  37. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
  38. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
  39. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
  40. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
  41. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
  42. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
  43. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/_models_info.py +13 -22
  44. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
  45. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/test_patching.py +10 -42
  46. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/utils/_launch_algorithms.py +4 -5
  47. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
  48. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +503 -0
  49. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +139 -0
  50. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +74 -0
  51. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
  52. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
  53. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
  54. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +734 -0
  55. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
  56. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +75 -0
  57. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
  58. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +693 -0
  59. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/__init__.py +83 -0
  60. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_config.py +54 -0
  61. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_device_offload.py +222 -0
  62. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp312-win_amd64.pyd +0 -0
  63. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp312-win_amd64.pyd +0 -0
  64. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
  65. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +107 -0
  66. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +160 -0
  67. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +298 -0
  68. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +196 -0
  69. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
  70. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +110 -0
  71. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +564 -0
  72. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +115 -0
  73. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
  74. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
  75. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
  76. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_base.py +38 -0
  77. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
  78. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
  79. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_policy.py +59 -0
  80. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_spmd_policy.py +30 -0
  81. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +125 -0
  82. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/tests/test_policy.py +76 -0
  83. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance}/__init__.py +3 -2
  84. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +125 -0
  85. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +146 -0
  86. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
  87. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +122 -0
  88. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +19 -0
  89. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +154 -0
  90. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +126 -0
  91. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +414 -0
  92. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition}/__init__.py +3 -2
  93. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +204 -0
  94. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +186 -0
  95. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +198 -0
  96. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
  97. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +727 -0
  98. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
  99. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
  100. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +258 -0
  101. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +329 -0
  102. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +249 -0
  103. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +168 -0
  104. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +107 -0
  105. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +250 -0
  106. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
  107. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
  108. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
  109. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +767 -0
  110. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
  111. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
  112. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +25 -0
  113. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +153 -0
  114. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
  115. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
  116. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/svm.py +556 -0
  117. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +351 -0
  118. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
  119. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
  120. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +176 -0
  121. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
  122. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/test_common.py +57 -0
  123. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +162 -0
  124. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +102 -0
  125. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/__init__.py +49 -0
  126. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +81 -0
  127. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/_dpep_helpers.py +56 -0
  128. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/validation.py +440 -0
  129. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__init__.py +10 -7
  130. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_config.py +22 -16
  131. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +126 -0
  132. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_utils.py +27 -4
  133. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
  134. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +230 -0
  135. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +345 -0
  136. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +270 -0
  137. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +404 -0
  138. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/__init__.py +1 -1
  139. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/dbscan.py +19 -10
  140. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +395 -0
  141. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +8 -6
  142. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +159 -0
  143. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
  144. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
  145. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +398 -0
  146. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +237 -0
  147. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +425 -0
  148. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_preview_pca.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +25 -9
  149. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/dispatcher.py +241 -60
  150. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/_forest.py +250 -188
  151. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +39 -21
  152. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/dispatcher.py +16 -2
  153. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
  154. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +13 -0
  155. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +482 -0
  156. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +425 -0
  157. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +341 -0
  158. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex}/linear_model/logistic_regression.py +194 -133
  159. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/linear_model/ridge.py +7 -0
  160. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +207 -0
  161. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +153 -0
  162. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
  163. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +134 -0
  164. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/t_sne.py +4 -0
  165. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/pairwise.py +5 -0
  166. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/ranking.py +3 -0
  167. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/split.py +5 -0
  168. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/__init__.py +1 -1
  169. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +236 -0
  170. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/common.py +53 -6
  171. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +51 -155
  172. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +46 -149
  173. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +55 -100
  174. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +16 -18
  175. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview}/__init__.py +1 -3
  176. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +138 -0
  177. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +18 -5
  178. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
  179. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +233 -0
  180. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +266 -0
  181. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model}/__init__.py +19 -19
  182. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/ridge.py +424 -0
  183. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_ridge.py +102 -0
  184. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/__init__.py +1 -0
  185. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
  186. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
  187. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +107 -0
  188. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +307 -0
  189. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +97 -0
  190. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +172 -0
  191. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
  192. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +21 -0
  193. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +37 -0
  194. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +107 -0
  195. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +184 -0
  196. {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition}/__init__.py +3 -2
  197. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +11 -12
  198. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +269 -0
  199. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +128 -0
  200. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +4 -12
  201. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +265 -0
  202. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +3 -1
  203. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +14 -18
  204. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
  205. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +329 -0
  206. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +145 -0
  207. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +162 -0
  208. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +288 -0
  209. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +339 -0
  210. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvc.py +172 -78
  211. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvr.py +74 -70
  212. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svc.py +170 -77
  213. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svr.py +66 -66
  214. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +12 -20
  215. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +390 -0
  216. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +123 -0
  217. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +379 -0
  218. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +276 -0
  219. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +108 -0
  220. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/tests/test_parallel.py +6 -8
  221. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +385 -0
  222. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +321 -0
  223. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +44 -0
  224. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +371 -0
  225. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
  226. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +82 -0
  227. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_finite.py +89 -0
  228. {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/METADATA +231 -230
  229. scikit_learn_intelex-2025.1.0.dist-info/RECORD +257 -0
  230. {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/WHEEL +1 -1
  231. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +0 -223
  232. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +0 -17
  233. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +0 -30
  234. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +0 -17
  235. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +0 -27
  236. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +0 -388
  237. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_path.py +0 -17
  238. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +0 -82
  239. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +0 -28
  240. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/neighbors/lof.py +0 -436
  241. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster/_common.py +0 -84
  242. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster/k_means.py +0 -376
  243. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +0 -98
  244. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/pca.py +0 -376
  245. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_preview_logistic_regression.py +0 -59
  246. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +0 -188
  247. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +0 -225
  248. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +0 -227
  249. scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability_tests.py +0 -428
  250. scikit_learn_intelex-2024.1.0.dist-info/RECORD +0 -97
  251. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__main__.py +0 -0
  252. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/decomposition/__init__.py +0 -0
  253. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +0 -0
  254. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/__init__.py +0 -0
  255. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/__main__.py +0 -0
  256. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/__init__.py +0 -0
  257. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +0 -0
  258. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/__init__.py +0 -0
  259. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +0 -0
  260. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/__init__.py +0 -0
  261. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +0 -0
  262. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +0 -0
  263. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +0 -0
  264. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +0 -0
  265. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +0 -0
  266. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +0 -0
  267. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +0 -0
  268. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +0 -0
  269. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +0 -0
  270. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +0 -0
  271. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/neighbors.py +0 -0
  272. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/__init__.py +0 -0
  273. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/__init__.py +0 -0
  274. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/parallel.py +0 -0
  275. {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/validation.py +0 -0
  276. {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/LICENSE.txt +0 -0
  277. {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,440 @@
1
+ # ==============================================================================
2
+ # Copyright 2021 Intel Corporation
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ # ==============================================================================
16
+
17
+ import warnings
18
+ from collections.abc import Sequence
19
+ from numbers import Integral
20
+
21
+ import numpy as np
22
+ from scipy import sparse as sp
23
+
24
+ if np.lib.NumpyVersion(np.__version__) >= np.lib.NumpyVersion("2.0.0a0"):
25
+ # numpy_version >= 2.0
26
+ from numpy.exceptions import VisibleDeprecationWarning
27
+ else:
28
+ # numpy_version < 2.0
29
+ from numpy import VisibleDeprecationWarning
30
+
31
+ from sklearn.preprocessing import LabelEncoder
32
+ from sklearn.utils.validation import check_array
33
+
34
+ from daal4py.sklearn.utils.validation import _assert_all_finite
35
+
36
+
37
+ class DataConversionWarning(UserWarning):
38
+ """Warning used to notify implicit data conversions happening in the code."""
39
+
40
+
41
+ def _is_arraylike(x):
42
+ """Returns whether the input is array-like."""
43
+ return hasattr(x, "__len__") or hasattr(x, "shape") or hasattr(x, "__array__")
44
+
45
+
46
+ def _is_arraylike_not_scalar(array):
47
+ """Return True if array is array-like and not a scalar"""
48
+ return _is_arraylike(array) and not np.isscalar(array)
49
+
50
+
51
+ def _column_or_1d(y, warn=False):
52
+ y = np.asarray(y)
53
+
54
+ # TODO: Convert this kind of arrays to a table like in daal4py
55
+ if not y.flags.aligned and not y.flags.writeable:
56
+ y = np.array(y.tolist())
57
+
58
+ shape = np.shape(y)
59
+ if len(shape) == 1:
60
+ return np.ravel(y)
61
+ if len(shape) == 2 and shape[1] == 1:
62
+ if warn:
63
+ warnings.warn(
64
+ "A column-vector y was passed when a 1d array was"
65
+ " expected. Please change the shape of y to "
66
+ "(n_samples, ), for example using ravel().",
67
+ DataConversionWarning,
68
+ stacklevel=2,
69
+ )
70
+ return np.ravel(y)
71
+
72
+ raise ValueError(
73
+ "y should be a 1d array, " "got an array of shape {} instead.".format(shape)
74
+ )
75
+
76
+
77
+ def _compute_class_weight(class_weight, classes, y):
78
+ if set(y) - set(classes):
79
+ raise ValueError("classes should include all valid labels that can " "be in y")
80
+ if class_weight is None or len(class_weight) == 0:
81
+ weight = np.ones(classes.shape[0], dtype=np.float64, order="C")
82
+ elif class_weight == "balanced":
83
+ y_ = _column_or_1d(y)
84
+ classes, _ = np.unique(y_, return_inverse=True)
85
+
86
+ le = LabelEncoder()
87
+ y_ind = le.fit_transform(y_)
88
+ if not all(np.in1d(classes, le.classes_)):
89
+ raise ValueError("classes should have valid labels that are in y")
90
+
91
+ y_bin = np.bincount(y_ind).astype(np.float64)
92
+ weight = len(y_) / (len(le.classes_) * y_bin)
93
+ else:
94
+ # user-defined dictionary
95
+ weight = np.ones(classes.shape[0], dtype=np.float64, order="C")
96
+ if not isinstance(class_weight, dict):
97
+ raise ValueError(
98
+ "class_weight must be dict, 'balanced', or None,"
99
+ " got: %r" % class_weight
100
+ )
101
+ for c in class_weight:
102
+ i = np.searchsorted(classes, c)
103
+ if i >= len(classes) or classes[i] != c:
104
+ raise ValueError("Class label {} not present.".format(c))
105
+ weight[i] = class_weight[c]
106
+
107
+ return weight
108
+
109
+
110
+ def _validate_targets(y, class_weight, dtype):
111
+ y_ = _column_or_1d(y, warn=True)
112
+ _check_classification_targets(y)
113
+ classes, y = np.unique(y_, return_inverse=True)
114
+ class_weight_res = _compute_class_weight(class_weight, classes=classes, y=y_)
115
+
116
+ if len(classes) < 2:
117
+ raise ValueError(
118
+ "The number of classes has to be greater than one; got %d"
119
+ " class" % len(classes)
120
+ )
121
+
122
+ return np.asarray(y, dtype=dtype, order="C"), class_weight_res, classes
123
+
124
+
125
+ def _check_array(
126
+ array,
127
+ dtype="numeric",
128
+ accept_sparse=False,
129
+ order=None,
130
+ copy=False,
131
+ force_all_finite=True,
132
+ ensure_2d=True,
133
+ accept_large_sparse=True,
134
+ ):
135
+ if force_all_finite:
136
+ if sp.issparse(array):
137
+ if hasattr(array, "data"):
138
+ _assert_all_finite(array.data)
139
+ force_all_finite = False
140
+ else:
141
+ _assert_all_finite(array)
142
+ force_all_finite = False
143
+ array = check_array(
144
+ array=array,
145
+ dtype=dtype,
146
+ accept_sparse=accept_sparse,
147
+ order=order,
148
+ copy=copy,
149
+ force_all_finite=force_all_finite,
150
+ ensure_2d=ensure_2d,
151
+ accept_large_sparse=accept_large_sparse,
152
+ )
153
+
154
+ if sp.issparse(array):
155
+ return array
156
+
157
+ # TODO: Convert this kind of arrays to a table like in daal4py
158
+ if not array.flags.aligned and not array.flags.writeable:
159
+ array = np.array(array.tolist())
160
+
161
+ # TODO: If data is not contiguous copy to contiguous
162
+ # Need implemeted numpy table in oneDAL
163
+ if not array.flags.c_contiguous and not array.flags.f_contiguous:
164
+ array = np.ascontiguousarray(array, array.dtype)
165
+ return array
166
+
167
+
168
+ def _check_X_y(
169
+ X,
170
+ y,
171
+ dtype="numeric",
172
+ accept_sparse=False,
173
+ order=None,
174
+ copy=False,
175
+ force_all_finite=True,
176
+ ensure_2d=True,
177
+ accept_large_sparse=True,
178
+ y_numeric=False,
179
+ accept_2d_y=False,
180
+ ):
181
+ if y is None:
182
+ raise ValueError("y cannot be None")
183
+
184
+ X = _check_array(
185
+ X,
186
+ accept_sparse=accept_sparse,
187
+ dtype=dtype,
188
+ order=order,
189
+ copy=copy,
190
+ force_all_finite=force_all_finite,
191
+ ensure_2d=ensure_2d,
192
+ accept_large_sparse=accept_large_sparse,
193
+ )
194
+
195
+ if not accept_2d_y:
196
+ y = _column_or_1d(y, warn=True)
197
+ else:
198
+ y = np.ascontiguousarray(y)
199
+
200
+ if y_numeric and y.dtype.kind == "O":
201
+ y = y.astype(np.float64)
202
+ if force_all_finite:
203
+ _assert_all_finite(y)
204
+
205
+ lengths = [X.shape[0], y.shape[0]]
206
+ uniques = np.unique(lengths)
207
+ if len(uniques) > 1:
208
+ raise ValueError(
209
+ "Found input variables with inconsistent numbers of"
210
+ " samples: %r" % [int(length) for length in lengths]
211
+ )
212
+
213
+ return X, y
214
+
215
+
216
+ def _check_classification_targets(y):
217
+ y_type = _type_of_target(y)
218
+ if y_type not in [
219
+ "binary",
220
+ "multiclass",
221
+ "multiclass-multioutput",
222
+ "multilabel-indicator",
223
+ "multilabel-sequences",
224
+ ]:
225
+ raise ValueError("Unknown label type: %r" % y_type)
226
+
227
+
228
+ def _type_of_target(y):
229
+ is_sequence, is_array = isinstance(y, Sequence), hasattr(y, "__array__")
230
+ is_not_string, is_sparse = not isinstance(y, str), sp.issparse(y)
231
+ valid = (is_sequence or is_array or is_sparse) and is_not_string
232
+
233
+ if not valid:
234
+ raise ValueError(
235
+ "Expected array-like (array or non-string sequence), " "got %r" % y
236
+ )
237
+
238
+ sparse_pandas = y.__class__.__name__ in ["SparseSeries", "SparseArray"]
239
+ if sparse_pandas:
240
+ raise ValueError("y cannot be class 'SparseSeries' or 'SparseArray'")
241
+
242
+ if _is_multilabel(y):
243
+ return "multilabel-indicator"
244
+
245
+ # DeprecationWarning will be replaced by ValueError, see NEP 34
246
+ # https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
247
+ with warnings.catch_warnings():
248
+ warnings.simplefilter("error", VisibleDeprecationWarning)
249
+ try:
250
+ y = np.asarray(y)
251
+ except VisibleDeprecationWarning:
252
+ # dtype=object should be provided explicitly for ragged arrays,
253
+ # see NEP 34
254
+ y = np.asarray(y, dtype=object)
255
+
256
+ # The old sequence of sequences format
257
+ try:
258
+ if (
259
+ not hasattr(y[0], "__array__")
260
+ and isinstance(y[0], Sequence)
261
+ and not isinstance(y[0], str)
262
+ ):
263
+ raise ValueError(
264
+ "You appear to be using a legacy multi-label data"
265
+ " representation. Sequence of sequences are no"
266
+ " longer supported; use a binary array or sparse"
267
+ " matrix instead - the MultiLabelBinarizer"
268
+ " transformer can convert to this format."
269
+ )
270
+ except IndexError:
271
+ pass
272
+
273
+ # Invalid inputs
274
+ if y.ndim > 2 or (y.dtype == object and len(y) and not isinstance(y.flat[0], str)):
275
+ return "unknown" # [[[1, 2]]] or [obj_1] and not ["label_1"]
276
+
277
+ if y.ndim == 2 and y.shape[1] == 0:
278
+ return "unknown" # [[]]
279
+
280
+ if y.ndim == 2 and y.shape[1] > 1:
281
+ suffix = "-multioutput" # [[1, 2], [1, 2]]
282
+ else:
283
+ suffix = "" # [1, 2, 3] or [[1], [2], [3]]
284
+
285
+ # check float and contains non-integer float values
286
+ if y.dtype.kind == "f" and np.any(y != y.astype(int)):
287
+ # [.1, .2, 3] or [[.1, .2, 3]] or [[1., .2]] and not [1., 2., 3.]
288
+ _assert_all_finite(y)
289
+ return "continuous" + suffix
290
+
291
+ if (len(np.unique(y)) > 2) or (y.ndim >= 2 and len(y[0]) > 1):
292
+ return "multiclass" + suffix # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]]
293
+ return "binary" # [1, 2] or [["a"], ["b"]]
294
+
295
+
296
+ def _is_integral_float(y):
297
+ return y.dtype.kind == "f" and np.all(y.astype(int) == y)
298
+
299
+
300
+ def _is_multilabel(y):
301
+ if hasattr(y, "__array__") or isinstance(y, Sequence):
302
+ # DeprecationWarning will be replaced by ValueError, see NEP 34
303
+ # https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
304
+ with warnings.catch_warnings():
305
+ warnings.simplefilter("error", VisibleDeprecationWarning)
306
+ try:
307
+ y = np.asarray(y)
308
+ except VisibleDeprecationWarning:
309
+ # dtype=object should be provided explicitly for ragged arrays,
310
+ # see NEP 34
311
+ y = np.array(y, dtype=object)
312
+
313
+ if not (hasattr(y, "shape") and y.ndim == 2 and y.shape[1] > 1):
314
+ return False
315
+
316
+ if sp.issparse(y):
317
+ if isinstance(y, (sp.dok_matrix, sp.lil_matrix)):
318
+ y = y.tocsr()
319
+ return (
320
+ len(y.data) == 0
321
+ or np.unique(y.data).size == 1
322
+ and (y.dtype.kind in "biu" or _is_integral_float(np.unique(y.data)))
323
+ )
324
+ labels = np.unique(y)
325
+
326
+ return len(labels) < 3 and (y.dtype.kind in "biu" or _is_integral_float(labels))
327
+
328
+
329
+ def _check_n_features(self, X, reset):
330
+ try:
331
+ n_features = _num_features(X)
332
+ except TypeError as e:
333
+ if not reset and hasattr(self, "n_features_in_"):
334
+ raise ValueError(
335
+ "X does not contain any features, but "
336
+ f"{self.__class__.__name__} is expecting "
337
+ f"{self.n_features_in_} features"
338
+ ) from e
339
+ # If the number of features is not defined and reset=True,
340
+ # then we skip this check
341
+ return
342
+
343
+ if reset:
344
+ self.n_features_in_ = n_features
345
+ return
346
+
347
+ if not hasattr(self, "n_features_in_"):
348
+ # Skip this check if the expected number of expected input features
349
+ # was not recorded by calling fit first. This is typically the case
350
+ # for stateless transformers.
351
+ return
352
+
353
+ if n_features != self.n_features_in_:
354
+ raise ValueError(
355
+ f"X has {n_features} features, but {self.__class__.__name__} "
356
+ f"is expecting {self.n_features_in_} features as input."
357
+ )
358
+
359
+
360
+ def _num_features(X, fallback_1d=False):
361
+ if X is None:
362
+ raise ValueError("Expected array-like (array or non-string sequence), got None")
363
+ type_ = type(X)
364
+ if type_.__module__ == "builtins":
365
+ type_name = type_.__qualname__
366
+ else:
367
+ type_name = f"{type_.__module__}.{type_.__qualname__}"
368
+ message = "Unable to find the number of features from X of type " f"{type_name}"
369
+ if not hasattr(X, "__len__") and not hasattr(X, "shape"):
370
+ if not hasattr(X, "__array__"):
371
+ raise ValueError(message)
372
+ # Only convert X to a numpy array if there is no cheaper, heuristic
373
+ # option.
374
+ X = np.asarray(X)
375
+
376
+ if hasattr(X, "shape"):
377
+ ndim_thr = 1 if fallback_1d else 2
378
+ if not hasattr(X.shape, "__len__") or len(X.shape) < ndim_thr:
379
+ message += f" with shape {X.shape}"
380
+ raise ValueError(message)
381
+ if len(X.shape) <= 1:
382
+ return 1
383
+ else:
384
+ return X.shape[-1]
385
+
386
+ try:
387
+ first_sample = X[0]
388
+ except IndexError:
389
+ raise ValueError("Passed empty data.")
390
+
391
+ # Do not consider an array-like of strings or dicts to be a 2D array
392
+ if isinstance(first_sample, (str, bytes, dict)):
393
+ message += f" where the samples are of type " f"{type(first_sample).__qualname__}"
394
+ raise ValueError(message)
395
+
396
+ try:
397
+ # If X is a list of lists, for instance, we assume that all nested
398
+ # lists have the same length without checking or converting to
399
+ # a numpy array to keep this function call as cheap as possible.
400
+ if (not fallback_1d) or hasattr(first_sample, "__len__"):
401
+ return len(first_sample)
402
+ else:
403
+ return 1
404
+ except Exception as err:
405
+ raise ValueError(message) from err
406
+
407
+
408
+ def _num_samples(x):
409
+ message = "Expected sequence or array-like, got %s" % type(x)
410
+ if hasattr(x, "fit") and callable(x.fit):
411
+ # Don't get num_samples from an ensembles length!
412
+ raise TypeError(message)
413
+
414
+ if not hasattr(x, "__len__") and not hasattr(x, "shape"):
415
+ if hasattr(x, "__array__"):
416
+ x = np.asarray(x)
417
+ else:
418
+ raise TypeError(message)
419
+
420
+ if hasattr(x, "shape") and x.shape is not None:
421
+ if len(x.shape) == 0:
422
+ raise TypeError(
423
+ "Singleton array %r cannot be considered a valid collection." % x
424
+ )
425
+ # Check that shape is returning an integer or default to len
426
+ # Dask dataframes may not return numeric shape[0] value
427
+ if hasattr(x, "shape") and isinstance(x.shape[0], Integral):
428
+ return x.shape[0]
429
+
430
+ try:
431
+ return len(x)
432
+ except TypeError as type_error:
433
+ raise TypeError(message) from type_error
434
+
435
+
436
+ def _is_csr(x):
437
+ """Return True if x is scipy.sparse.csr_matrix or scipy.sparse.csr_array"""
438
+ return isinstance(x, sp.csr_matrix) or (
439
+ hasattr(sp, "csr_array") and isinstance(x, sp.csr_array)
440
+ )
@@ -1,5 +1,6 @@
1
1
  # ==============================================================================
2
2
  # Copyright 2021 Intel Corporation
3
+ # Copyright 2024 Fujitsu Limited
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
@@ -14,7 +15,7 @@
14
15
  # limitations under the License.
15
16
  # ==============================================================================
16
17
 
17
- from onedal.common.hyperparameters import get_hyperparameters
18
+ import os
18
19
 
19
20
  from . import utils
20
21
  from ._config import config_context, get_config, set_config
@@ -31,6 +32,7 @@ __all__ = [
31
32
  "basic_statistics",
32
33
  "cluster",
33
34
  "config_context",
35
+ "covariance",
34
36
  "decomposition",
35
37
  "ensemble",
36
38
  "get_config",
@@ -41,21 +43,22 @@ __all__ = [
41
43
  "linear_model",
42
44
  "manifold",
43
45
  "metrics",
46
+ "model_selection",
44
47
  "neighbors",
45
48
  "patch_sklearn",
46
49
  "set_config",
47
50
  "sklearn_is_patched",
48
- "sklearn_is_patchedget_patch_map",
49
51
  "svm",
50
52
  "unpatch_sklearn",
51
53
  "utils",
52
54
  ]
55
+ onedal_iface_flag = os.environ.get("OFF_ONEDAL_IFACE", "0")
56
+ if onedal_iface_flag == "0":
57
+ from onedal import _is_spmd_backend
58
+ from onedal.common.hyperparameters import get_hyperparameters
53
59
 
54
-
55
- from onedal import _is_dpc_backend
56
-
57
- if _is_dpc_backend:
58
- __all__.append("spmd")
60
+ if _is_spmd_backend:
61
+ __all__.append("spmd")
59
62
 
60
63
 
61
64
  from ._utils import set_sklearn_ex_verbose
@@ -14,24 +14,14 @@
14
14
  # limitations under the License.
15
15
  # ==============================================================================
16
16
 
17
- import threading
18
17
  from contextlib import contextmanager
18
+ from os import environ
19
19
 
20
20
  from sklearn import get_config as skl_get_config
21
21
  from sklearn import set_config as skl_set_config
22
22
 
23
- _default_global_config = {
24
- "target_offload": "auto",
25
- "allow_fallback_to_host": False,
26
- }
27
-
28
- _threadlocal = threading.local()
29
-
30
-
31
- def _get_sklearnex_threadlocal_config():
32
- if not hasattr(_threadlocal, "global_config"):
33
- _threadlocal.global_config = _default_global_config.copy()
34
- return _threadlocal.global_config
23
+ from daal4py.sklearn._utils import sklearn_check_version
24
+ from onedal._config import _get_config as onedal_get_config
35
25
 
36
26
 
37
27
  def get_config():
@@ -46,11 +36,16 @@ def get_config():
46
36
  set_config : Set global configuration.
47
37
  """
48
38
  sklearn = skl_get_config()
49
- sklearnex = _get_sklearnex_threadlocal_config().copy()
39
+ sklearnex = onedal_get_config()
50
40
  return {**sklearn, **sklearnex}
51
41
 
52
42
 
53
- def set_config(target_offload=None, allow_fallback_to_host=None, **sklearn_configs):
43
+ def set_config(
44
+ target_offload=None,
45
+ allow_fallback_to_host=None,
46
+ allow_sklearn_after_onedal=None,
47
+ **sklearn_configs,
48
+ ):
54
49
  """Set global configuration
55
50
  Parameters
56
51
  ----------
@@ -63,19 +58,30 @@ def set_config(target_offload=None, allow_fallback_to_host=None, **sklearn_confi
63
58
  If True, allows to fallback computation to host device
64
59
  in case particular estimator does not support the selected one.
65
60
  Global default: False.
61
+ allow_sklearn_after_onedal : bool, default=None
62
+ If True, allows to fallback computation to sklearn after onedal
63
+ backend in case of runtime error on onedal backend computations.
64
+ Global default: True.
66
65
  See Also
67
66
  --------
68
67
  config_context : Context manager for global configuration.
69
68
  get_config : Retrieve current values of the global configuration.
70
69
  """
70
+
71
+ array_api_dispatch = sklearn_configs.get("array_api_dispatch", False)
72
+ if array_api_dispatch and sklearn_check_version("1.6"):
73
+ environ["SCIPY_ARRAY_API"] = "1"
74
+
71
75
  skl_set_config(**sklearn_configs)
72
76
 
73
- local_config = _get_sklearnex_threadlocal_config()
77
+ local_config = onedal_get_config(copy=False)
74
78
 
75
79
  if target_offload is not None:
76
80
  local_config["target_offload"] = target_offload
77
81
  if allow_fallback_to_host is not None:
78
82
  local_config["allow_fallback_to_host"] = allow_fallback_to_host
83
+ if allow_sklearn_after_onedal is not None:
84
+ local_config["allow_sklearn_after_onedal"] = allow_sklearn_after_onedal
79
85
 
80
86
 
81
87
  @contextmanager
@@ -0,0 +1,126 @@
1
+ # ==============================================================================
2
+ # Copyright 2021 Intel Corporation
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ # ==============================================================================
16
+
17
+ from functools import wraps
18
+
19
+ from onedal._device_offload import _copy_to_usm, _get_global_queue, _transfer_to_host
20
+ from onedal.utils._array_api import _asarray
21
+ from onedal.utils._dpep_helpers import dpnp_available
22
+
23
+ if dpnp_available:
24
+ import dpnp
25
+ from onedal.utils._array_api import _convert_to_dpnp
26
+
27
+ from ._config import get_config
28
+
29
+
30
+ def _get_backend(obj, queue, method_name, *data):
31
+ cpu_device = queue is None or queue.sycl_device.is_cpu
32
+ gpu_device = queue is not None and queue.sycl_device.is_gpu
33
+
34
+ if cpu_device:
35
+ patching_status = obj._onedal_cpu_supported(method_name, *data)
36
+ if patching_status.get_status():
37
+ return "onedal", queue, patching_status
38
+ else:
39
+ return "sklearn", None, patching_status
40
+
41
+ allow_fallback_to_host = get_config()["allow_fallback_to_host"]
42
+
43
+ if gpu_device:
44
+ patching_status = obj._onedal_gpu_supported(method_name, *data)
45
+ if patching_status.get_status():
46
+ return "onedal", queue, patching_status
47
+ else:
48
+ if allow_fallback_to_host:
49
+ patching_status = obj._onedal_cpu_supported(method_name, *data)
50
+ if patching_status.get_status():
51
+ return "onedal", None, patching_status
52
+ else:
53
+ return "sklearn", None, patching_status
54
+ else:
55
+ return "sklearn", None, patching_status
56
+
57
+ raise RuntimeError("Device support is not implemented")
58
+
59
+
60
+ def dispatch(obj, method_name, branches, *args, **kwargs):
61
+ q = _get_global_queue()
62
+ has_usm_data_for_args, q, hostargs = _transfer_to_host(q, *args)
63
+ has_usm_data_for_kwargs, q, hostvalues = _transfer_to_host(q, *kwargs.values())
64
+ hostkwargs = dict(zip(kwargs.keys(), hostvalues))
65
+
66
+ backend, q, patching_status = _get_backend(obj, q, method_name, *hostargs)
67
+ has_usm_data = has_usm_data_for_args or has_usm_data_for_kwargs
68
+ if backend == "onedal":
69
+ # Host args only used before onedal backend call.
70
+ # Device will be offloaded when onedal backend will be called.
71
+ patching_status.write_log(queue=q, transferred_to_host=False)
72
+ return branches[backend](obj, *hostargs, **hostkwargs, queue=q)
73
+ if backend == "sklearn":
74
+ if (
75
+ "array_api_dispatch" in get_config()
76
+ and get_config()["array_api_dispatch"]
77
+ and "array_api_support" in obj._get_tags()
78
+ and obj._get_tags()["array_api_support"]
79
+ and not has_usm_data
80
+ ):
81
+ # USM ndarrays are also excluded for the fallback Array API. Currently, DPNP.ndarray is
82
+ # not compliant with the Array API standard, and DPCTL usm_ndarray Array API is compliant,
83
+ # except for the linalg module. There is no guarantee that stock scikit-learn will
84
+ # work with such input data. The condition will be updated after DPNP.ndarray and
85
+ # DPCTL usm_ndarray enabling for conformance testing and these arrays supportance
86
+ # of the fallback cases.
87
+ # If `array_api_dispatch` enabled and array api is supported for the stock scikit-learn,
88
+ # then raw inputs are used for the fallback.
89
+ patching_status.write_log(transferred_to_host=False)
90
+ return branches[backend](obj, *args, **kwargs)
91
+ else:
92
+ patching_status.write_log()
93
+ return branches[backend](obj, *hostargs, **hostkwargs)
94
+ raise RuntimeError(
95
+ f"Undefined backend {backend} in " f"{obj.__class__.__name__}.{method_name}"
96
+ )
97
+
98
+
99
+ def wrap_output_data(func):
100
+ """
101
+ Converts and moves the output arrays of the decorated function
102
+ to match the input array type and device.
103
+ """
104
+
105
+ @wraps(func)
106
+ def wrapper(self, *args, **kwargs):
107
+ result = func(self, *args, **kwargs)
108
+ if not (len(args) == 0 and len(kwargs) == 0):
109
+ data = (*args, *kwargs.values())
110
+ usm_iface = getattr(data[0], "__sycl_usm_array_interface__", None)
111
+ if usm_iface is not None:
112
+ result = _copy_to_usm(usm_iface["syclobj"], result)
113
+ if dpnp_available and isinstance(data[0], dpnp.ndarray):
114
+ result = _convert_to_dpnp(result)
115
+ return result
116
+ config = get_config()
117
+ if not ("transform_output" in config and config["transform_output"]):
118
+ input_array_api = getattr(data[0], "__array_namespace__", lambda: None)()
119
+ if input_array_api:
120
+ input_array_api_device = data[0].device
121
+ result = _asarray(
122
+ result, input_array_api, device=input_array_api_device
123
+ )
124
+ return result
125
+
126
+ return wrapper