scikit-learn-intelex 2025.10.0__py313-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.
Files changed (267) hide show
  1. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
  2. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
  3. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/_daal4py.cp313-win_amd64.pyd +0 -0
  4. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +94 -0
  5. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/gbt_convertors.py +1199 -0
  6. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/logistic_regression_builders.py +211 -0
  7. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/tree_based_builders.py +425 -0
  8. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp313-win_amd64.pyd +0 -0
  9. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
  10. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +252 -0
  11. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
  12. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
  13. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
  14. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +565 -0
  15. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
  16. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/__init__.py +19 -0
  17. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +528 -0
  18. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +192 -0
  19. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +333 -0
  20. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
  21. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1285 -0
  22. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
  23. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/__init__.py +29 -0
  24. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +826 -0
  25. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +269 -0
  26. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +290 -0
  27. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +17 -0
  28. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
  29. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
  30. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +561 -0
  31. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
  32. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_enet.py +157 -0
  33. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +198 -0
  34. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
  35. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/__init__.py +19 -0
  36. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +432 -0
  37. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
  38. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +259 -0
  39. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
  40. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
  41. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
  42. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
  43. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
  44. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
  45. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/_models_info.py +164 -0
  46. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
  47. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_patching.py +90 -0
  48. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py +117 -0
  49. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
  50. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +493 -0
  51. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +136 -0
  52. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +72 -0
  53. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
  54. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
  55. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
  56. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +736 -0
  57. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
  58. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +80 -0
  59. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
  60. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +772 -0
  61. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/__init__.py +151 -0
  62. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_config.py +80 -0
  63. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_device_offload.py +199 -0
  64. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp313-win_amd64.pyd +0 -0
  65. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp313-win_amd64.pyd +0 -0
  66. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
  67. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +151 -0
  68. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +165 -0
  69. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +241 -0
  70. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +279 -0
  71. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/utils.py +50 -0
  72. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
  73. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +80 -0
  74. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +582 -0
  75. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +145 -0
  76. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
  77. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
  78. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
  79. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_backend.py +258 -0
  80. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
  81. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
  82. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +148 -0
  83. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/tests/test_sycl.py +148 -0
  84. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/__init__.py +20 -0
  85. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +121 -0
  86. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +151 -0
  87. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
  88. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +190 -0
  89. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +29 -0
  90. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +158 -0
  91. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_dlpack.py +64 -0
  92. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_sycl_usm.py +63 -0
  93. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +131 -0
  94. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +686 -0
  95. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/__init__.py +20 -0
  96. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +218 -0
  97. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +124 -0
  98. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +291 -0
  99. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/__init__.py +19 -0
  100. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/dummy.py +137 -0
  101. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
  102. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +781 -0
  103. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
  104. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
  105. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +201 -0
  106. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +230 -0
  107. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +293 -0
  108. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +213 -0
  109. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +171 -0
  110. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +252 -0
  111. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
  112. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
  113. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
  114. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +690 -0
  115. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
  116. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
  117. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +27 -0
  118. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +202 -0
  119. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
  120. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
  121. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/svm.py +592 -0
  122. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +352 -0
  123. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
  124. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
  125. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +168 -0
  126. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
  127. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/test_common.py +71 -0
  128. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +179 -0
  129. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +94 -0
  130. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +98 -0
  131. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_sycl_queue_manager.py +213 -0
  132. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_third_party.py +220 -0
  133. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/tests/test_validation.py +142 -0
  134. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/validation.py +503 -0
  135. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__init__.py +69 -0
  136. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__main__.py +58 -0
  137. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_config.py +163 -0
  138. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +205 -0
  139. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_utils.py +219 -0
  140. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/base.py +109 -0
  141. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
  142. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +241 -0
  143. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +338 -0
  144. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +405 -0
  145. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +455 -0
  146. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/__init__.py +20 -0
  147. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +199 -0
  148. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +399 -0
  149. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +38 -0
  150. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +157 -0
  151. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
  152. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
  153. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +440 -0
  154. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +307 -0
  155. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/__init__.py +19 -0
  156. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +558 -0
  157. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +164 -0
  158. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dispatcher.py +572 -0
  159. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +629 -0
  160. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/__init__.py +19 -0
  161. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/_dummy.py +615 -0
  162. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/tests/test_dummy.py +62 -0
  163. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/__init__.py +29 -0
  164. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/_forest.py +1799 -0
  165. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +196 -0
  166. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/__main__.py +72 -0
  167. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/dispatcher.py +101 -0
  168. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
  169. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +44 -0
  170. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +427 -0
  171. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +407 -0
  172. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +363 -0
  173. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_regression.py +466 -0
  174. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py +407 -0
  175. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +267 -0
  176. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +214 -0
  177. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
  178. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +565 -0
  179. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_ridge.py +256 -0
  180. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/__init__.py +19 -0
  181. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py +28 -0
  182. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +256 -0
  183. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/__init__.py +23 -0
  184. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/pairwise.py +20 -0
  185. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/ranking.py +20 -0
  186. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +39 -0
  187. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/__init__.py +21 -0
  188. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/split.py +20 -0
  189. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +34 -0
  190. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/__init__.py +27 -0
  191. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +189 -0
  192. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/common.py +313 -0
  193. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +189 -0
  194. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +167 -0
  195. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +170 -0
  196. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +82 -0
  197. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/__init__.py +17 -0
  198. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +19 -0
  199. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +261 -0
  200. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +112 -0
  201. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
  202. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +406 -0
  203. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +390 -0
  204. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/__init__.py +25 -0
  205. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
  206. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +24 -0
  207. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
  208. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +117 -0
  209. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +314 -0
  210. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +30 -0
  211. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +26 -0
  212. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +21 -0
  213. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +108 -0
  214. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +180 -0
  215. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
  216. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +24 -0
  217. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +29 -0
  218. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +120 -0
  219. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +200 -0
  220. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/__init__.py +20 -0
  221. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +23 -0
  222. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +23 -0
  223. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +276 -0
  224. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +146 -0
  225. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +19 -0
  226. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +299 -0
  227. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +299 -0
  228. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +21 -0
  229. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +28 -0
  230. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +24 -0
  231. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
  232. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +345 -0
  233. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +162 -0
  234. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +169 -0
  235. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +23 -0
  236. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +433 -0
  237. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/__init__.py +29 -0
  238. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +403 -0
  239. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvc.py +278 -0
  240. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvr.py +158 -0
  241. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svc.py +306 -0
  242. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svr.py +155 -0
  243. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +124 -0
  244. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +607 -0
  245. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +256 -0
  246. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_hyperparameters.py +111 -0
  247. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +335 -0
  248. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +269 -0
  249. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +111 -0
  250. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_parallel.py +48 -0
  251. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +418 -0
  252. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +335 -0
  253. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +48 -0
  254. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +420 -0
  255. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
  256. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/__init__.py +19 -0
  257. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +217 -0
  258. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/class_weight.py +100 -0
  259. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/parallel.py +97 -0
  260. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_class_weight.py +69 -0
  261. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_validation.py +238 -0
  262. scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/validation.py +212 -0
  263. scikit_learn_intelex-2025.10.0.dist-info/LICENSE.txt +202 -0
  264. scikit_learn_intelex-2025.10.0.dist-info/METADATA +182 -0
  265. scikit_learn_intelex-2025.10.0.dist-info/RECORD +267 -0
  266. scikit_learn_intelex-2025.10.0.dist-info/WHEEL +5 -0
  267. scikit_learn_intelex-2025.10.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,163 @@
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 sys
18
+ from contextlib import contextmanager
19
+
20
+ from sklearn import get_config as skl_get_config
21
+ from sklearn import set_config as skl_set_config
22
+
23
+ from daal4py.sklearn._utils import sklearn_check_version
24
+ from onedal._config import _get_config as onedal_get_config
25
+
26
+ __all__ = ["get_config", "set_config", "config_context"]
27
+
28
+ tab = " " if (sys.version_info.major == 3 and sys.version_info.minor < 13) else ""
29
+ _options_docstring = f"""Parameters
30
+ {tab}----------
31
+ {tab}target_offload : str or dpctl.SyclQueue or None
32
+ {tab} The device used to perform computations, either as a string indicating a name
33
+ {tab} recognized by the SyCL runtime, such as ``"gpu"``, ``"gpu:0"``, or as a
34
+ {tab} :obj:`dpctl.SyclQueue` object indicating where to move the data.
35
+ {tab}
36
+ {tab} Assuming SyCL-related dependencies are installed, the list of devices recognized
37
+ {tab} by SyCL can be retrieved through the CLI tool ``sycl-ls`` in a shell, or through
38
+ {tab} :obj:`dpctl.get_devices` in a Python process.
39
+ {tab}
40
+ {tab} String ``"auto"`` is also accepted.
41
+ {tab}
42
+ {tab} Global default: ``"auto"``.
43
+ {tab}
44
+ {tab}allow_fallback_to_host : bool or None
45
+ {tab} If ``True``, allows computations to fall back to host device (CPU) when an unsupported
46
+ {tab} operation is attempted on GPU through ``target_offload``.
47
+ {tab}
48
+ {tab} Global default: ``False``.
49
+ {tab}
50
+ {tab}allow_sklearn_after_onedal : bool or None, default=None
51
+ {tab} If ``True``, allows computations to fall back to stock scikit-learn when no
52
+ {tab} accelered version of the operation is available (see :ref:`algorithms`).
53
+ {tab}
54
+ {tab} Global default: ``True``.
55
+ {tab}
56
+ {tab}use_raw_input : bool or None
57
+ {tab} If ``True``, uses the raw input data in some SPMD onedal backend computations
58
+ {tab} without any checks on data consistency or validity. Note that this can be
59
+ {tab} better achieved through usage of :ref:`array API classes <array_api>` without
60
+ {tab} ``target_offload``. Not recommended for general use.
61
+ {tab}
62
+ {tab} Global default: ``False``.
63
+ {tab}
64
+ {tab} .. deprecated:: 2026.0
65
+ {tab}
66
+ {tab}sklearn_configs : kwargs
67
+ {tab} Other settings accepted by scikit-learn. See :obj:`sklearn.set_config` for
68
+ {tab} details.
69
+ {tab}
70
+ {tab}Warnings
71
+ {tab}--------
72
+ {tab}Using ``use_raw_input=True`` is not recommended for general use as it
73
+ {tab}bypasses data consistency checks, which may lead to unexpected behavior. It is
74
+ {tab}recommended to use the newer :ref:`array API <array_api>` instead.
75
+ {tab}
76
+ {tab}Note
77
+ {tab}----
78
+ {tab}Usage of ``target_offload`` requires additional dependencies - see
79
+ {tab}:ref:`GPU support <oneapi_gpu>` for more information."""
80
+
81
+
82
+ def get_config():
83
+ """Retrieve current values for configuration set by :func:`set_config`.
84
+
85
+ Returns
86
+ -------
87
+ config : dict
88
+ Keys are parameter names that can be passed to :func:`set_config`.
89
+
90
+ See Also
91
+ --------
92
+ config_context : Context manager for global configuration.
93
+ set_config : Set global configuration.
94
+ """
95
+ sklearn = skl_get_config()
96
+ sklearnex = onedal_get_config()
97
+ return {**sklearn, **sklearnex}
98
+
99
+
100
+ def set_config(
101
+ target_offload=None,
102
+ allow_fallback_to_host=None,
103
+ allow_sklearn_after_onedal=None,
104
+ use_raw_input=None,
105
+ **sklearn_configs,
106
+ ): # numpydoc ignore=PR01,PR07
107
+ """Set global configuration.
108
+
109
+ %_options_docstring%
110
+
111
+ See Also
112
+ --------
113
+ config_context : Context manager for global configuration.
114
+ get_config : Retrieve current values of the global configuration.
115
+ """
116
+
117
+ skl_set_config(**sklearn_configs)
118
+
119
+ local_config = onedal_get_config(copy=False)
120
+
121
+ if target_offload is not None:
122
+ local_config["target_offload"] = target_offload
123
+ if allow_fallback_to_host is not None:
124
+ local_config["allow_fallback_to_host"] = allow_fallback_to_host
125
+ if allow_sklearn_after_onedal is not None:
126
+ local_config["allow_sklearn_after_onedal"] = allow_sklearn_after_onedal
127
+ if use_raw_input is not None:
128
+ local_config["use_raw_input"] = use_raw_input
129
+
130
+
131
+ set_config.__doc__ = set_config.__doc__.replace(
132
+ "%_options_docstring%", _options_docstring
133
+ )
134
+
135
+
136
+ @contextmanager
137
+ def config_context(**new_config): # numpydoc ignore=PR01,PR07
138
+ """Context manager for local scikit-learn-intelex configurations.
139
+
140
+ %_options_docstring%
141
+
142
+ Note
143
+ ----
144
+ All settings, not just those presently modified, will be returned to
145
+ their previous values when the context manager is exited.
146
+
147
+ See Also
148
+ --------
149
+ set_config : Set global scikit-learn configuration.
150
+ get_config : Retrieve current values of the global configuration.
151
+ """
152
+ old_config = get_config()
153
+ set_config(**new_config)
154
+
155
+ try:
156
+ yield
157
+ finally:
158
+ set_config(**old_config)
159
+
160
+
161
+ config_context.__doc__ = config_context.__doc__.replace(
162
+ "%_options_docstring%", _options_docstring
163
+ )
@@ -0,0 +1,205 @@
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 collections.abc import Callable
18
+ from functools import wraps
19
+ from typing import Any, Union
20
+
21
+ from onedal._device_offload import _transfer_to_host
22
+ from onedal.datatypes import copy_to_dpnp, copy_to_usm
23
+ from onedal.utils import _sycl_queue_manager as QM
24
+ from onedal.utils._array_api import _asarray, _is_numpy_namespace
25
+ from onedal.utils._third_party import is_dpnp_ndarray
26
+
27
+ from ._config import config_context, get_config, set_config
28
+ from ._utils import PatchingConditionsChain, get_tags
29
+ from .base import oneDALEstimator
30
+
31
+
32
+ def _get_backend(
33
+ obj: type[oneDALEstimator], method_name: str, *data
34
+ ) -> tuple[Union[bool, None], PatchingConditionsChain]:
35
+ """This function verifies the hardware conditions, data characteristics, and
36
+ estimator parameters necessary for offloading computation to oneDAL. The status
37
+ of this patching is returned as a PatchingConditionsChain object along with a
38
+ boolean flag signaling whether the computation can be offloaded to oneDAL or not.
39
+ It is assumed that the queue (which determined what hardware to possibly use for
40
+ oneDAL) has been previously and extensively collected (i.e. the data has already
41
+ been checked using onedal's SyclQueueManager for queues)."""
42
+ queue = QM.get_global_queue()
43
+ cpu_device = queue is None or getattr(queue.sycl_device, "is_cpu", True)
44
+ gpu_device = queue is not None and getattr(queue.sycl_device, "is_gpu", False)
45
+
46
+ if cpu_device:
47
+ patching_status = obj._onedal_cpu_supported(method_name, *data)
48
+ return patching_status.get_status(), patching_status
49
+
50
+ if gpu_device:
51
+ patching_status = obj._onedal_gpu_supported(method_name, *data)
52
+ if not patching_status.get_status() and get_config()["allow_fallback_to_host"]:
53
+ QM.fallback_to_host()
54
+ return None, patching_status
55
+ return patching_status.get_status(), patching_status
56
+
57
+ if get_config()["allow_fallback_to_host"]:
58
+ # This may trigger if the ``onedal.utils._sycl_queue_manager.__non_queue``
59
+ # object is the queue (e.g. if non-SYCL device data is encountered)
60
+ QM.fallback_to_host()
61
+ return None, None
62
+ raise RuntimeError("Device support is not implemented for the supplied data type.")
63
+
64
+
65
+ if "array_api_dispatch" in get_config():
66
+ _array_api_offload = lambda: get_config()["array_api_dispatch"]
67
+ else:
68
+ _array_api_offload = lambda: False
69
+
70
+
71
+ def dispatch(
72
+ obj: type[oneDALEstimator],
73
+ method_name: str,
74
+ branches: dict[Callable, Callable],
75
+ *args,
76
+ **kwargs,
77
+ ) -> Any:
78
+ """Dispatch object method call to oneDAL if conditionally possible.
79
+
80
+ Depending on support conditions, oneDAL will be called, otherwise it will
81
+ fall back to calling scikit-learn. Dispatching to oneDAL can be influenced
82
+ by the 'use_raw_input' or 'allow_fallback_to_host' config parameters.
83
+
84
+ Parameters
85
+ ----------
86
+ obj : object
87
+ Sklearnex object which inherits from oneDALEstimator and contains
88
+ ``onedal_cpu_supported`` and ``onedal_gpu_supported`` methods which
89
+ evaluate oneDAL support.
90
+
91
+ method_name : str
92
+ Name of method to be evaluated for oneDAL support.
93
+
94
+ branches : dict
95
+ Dictionary containing functions to be called. Only keys 'sklearn' and
96
+ 'onedal' are used which should contain the relevant scikit-learn and
97
+ onedal object methods respectively. All functions should accept the
98
+ inputs from *args and **kwargs. Additionally, the onedal object method
99
+ must accept a 'queue' keyword.
100
+
101
+ *args : tuple
102
+ Arguments to be supplied to the dispatched method.
103
+
104
+ **kwargs : dict
105
+ Keyword arguments to be supplied to the dispatched method.
106
+
107
+ Returns
108
+ -------
109
+ unknown : object
110
+ Returned object dependent on the supplied branches. Implicitly the returned
111
+ object types should match for the sklearn and onedal object methods.
112
+ """
113
+
114
+ if get_config()["use_raw_input"]:
115
+ return branches["onedal"](obj, *args, **kwargs)
116
+
117
+ # Determine if array_api dispatching is enabled, and if estimator is capable
118
+ onedal_array_api = _array_api_offload() and get_tags(obj).onedal_array_api
119
+ sklearn_array_api = _array_api_offload() and get_tags(obj).array_api_support
120
+
121
+ # backend can only be a boolean or None, None signifies an unverified backend
122
+ backend: "bool | None" = None
123
+
124
+ # The _sycl_queue_manager verifies all arguments are on a single SYCL device or
125
+ # cpu and will otherwise throw an error. If located on a non-SYCL, non-CPU
126
+ # device, a special queue is set which will cause a failure in ``_get_backend``
127
+ with QM.manage_global_queue(None, *args):
128
+ if onedal_array_api:
129
+ backend, patching_status = _get_backend(obj, method_name, *args)
130
+ if backend:
131
+ queue = QM.get_global_queue()
132
+ patching_status.write_log(queue=queue, transferred_to_host=False)
133
+ return branches["onedal"](obj, *args, **kwargs, queue=queue)
134
+ elif sklearn_array_api and backend is False:
135
+ patching_status.write_log(transferred_to_host=False)
136
+ return branches["sklearn"](obj, *args, **kwargs)
137
+
138
+ # move data to host because of multiple reasons: array_api fallback to host,
139
+ # non array_api supporting oneDAL code, issues with usm support in sklearn.
140
+ has_usm_data_for_args, hostargs = _transfer_to_host(*args)
141
+ has_usm_data_for_kwargs, hostvalues = _transfer_to_host(*kwargs.values())
142
+
143
+ hostkwargs = dict(zip(kwargs.keys(), hostvalues))
144
+ has_usm_data = has_usm_data_for_args or has_usm_data_for_kwargs
145
+
146
+ while backend is None:
147
+ backend, patching_status = _get_backend(obj, method_name, *hostargs)
148
+
149
+ if backend:
150
+ queue = QM.get_global_queue()
151
+ patching_status.write_log(queue=queue, transferred_to_host=False)
152
+ return branches["onedal"](obj, *hostargs, **hostkwargs, queue=queue)
153
+ else:
154
+ if sklearn_array_api and not has_usm_data:
155
+ # dpnp fallback is not handled properly yet.
156
+ patching_status.write_log(transferred_to_host=False)
157
+ return branches["sklearn"](obj, *args, **kwargs)
158
+ else:
159
+ patching_status.write_log()
160
+ return branches["sklearn"](obj, *hostargs, **hostkwargs)
161
+
162
+
163
+ def wrap_output_data(func: Callable) -> Callable:
164
+ """Transform function output to match input format.
165
+
166
+ Converts and moves the output arrays of the decorated function
167
+ to match the input array type and device.
168
+
169
+ Parameters
170
+ ----------
171
+ func : callable
172
+ Function or method which has array data as input.
173
+
174
+ Returns
175
+ -------
176
+ wrapper : callable
177
+ Wrapped function or method which will return matching format.
178
+ """
179
+
180
+ @wraps(func)
181
+ def wrapper(self, *args, **kwargs) -> Any:
182
+ result = func(self, *args, **kwargs)
183
+ if not (len(args) == 0 and len(kwargs) == 0):
184
+ data = (*args, *kwargs.values())[0]
185
+ # Remove check for result __sycl_usm_array_interface__ on deprecation of use_raw_inputs
186
+ if (
187
+ usm_iface := getattr(data, "__sycl_usm_array_interface__", None)
188
+ ) and not hasattr(result, "__sycl_usm_array_interface__"):
189
+ queue = usm_iface["syclobj"]
190
+ return (
191
+ copy_to_dpnp(queue, result)
192
+ if is_dpnp_ndarray(data)
193
+ else copy_to_usm(queue, result)
194
+ )
195
+
196
+ if get_config().get("transform_output") in ("default", None):
197
+ input_array_api = getattr(data, "__array_namespace__", lambda: None)()
198
+ if input_array_api and not _is_numpy_namespace(input_array_api):
199
+ input_array_api_device = data.device
200
+ result = _asarray(
201
+ result, input_array_api, device=input_array_api_device
202
+ )
203
+ return result
204
+
205
+ return wrapper
@@ -0,0 +1,219 @@
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 logging
18
+ import os
19
+ import re
20
+ import sys
21
+ import warnings
22
+ from abc import ABC
23
+
24
+ import sklearn
25
+
26
+ from daal4py.sklearn._utils import (
27
+ PatchingConditionsChain as daal4py_PatchingConditionsChain,
28
+ )
29
+ from daal4py.sklearn._utils import daal_check_version, sklearn_check_version
30
+ from onedal.common.hyperparameters import (
31
+ get_hyperparameters as onedal_get_hyperparameters,
32
+ )
33
+ from onedal.common.hyperparameters import (
34
+ reset_hyperparameters as onedal_reset_hyperparameters,
35
+ )
36
+
37
+ # Not an ideal solution, but this allows for access to the outputs of older
38
+ # sklearnex tag dictionaries in a way similar to the sklearn >=1.6 tag
39
+ # dataclasses via duck-typing. At some point this must be removed for direct
40
+ # use of get_tags in all circumstances, dictated by sklearn support. This is
41
+ # implemented in a way to minimally impact performance.
42
+
43
+
44
+ if sklearn_check_version("1.6"):
45
+ from sklearn.utils import get_tags
46
+ else:
47
+ from sklearn.base import BaseEstimator
48
+
49
+ get_tags = lambda obj: type("Tags", (), BaseEstimator._get_tags(obj))
50
+
51
+
52
+ class PatchingConditionsChain(daal4py_PatchingConditionsChain):
53
+ def get_status(self):
54
+ return self.patching_is_enabled
55
+
56
+ def write_log(self, queue=None, transferred_to_host=True):
57
+ if self.patching_is_enabled:
58
+ self.logger.info(
59
+ f"{self.scope_name}: {get_patch_message('onedal', queue=queue, transferred_to_host=transferred_to_host)}"
60
+ )
61
+ else:
62
+ self.logger.debug(
63
+ f"{self.scope_name}: debugging for the patch is enabled to track"
64
+ " the usage of oneAPI Data Analytics Library (oneDAL)"
65
+ )
66
+ for message in self.messages:
67
+ self.logger.debug(
68
+ f"{self.scope_name}: patching failed with cause - {message}"
69
+ )
70
+ self.logger.info(
71
+ f"{self.scope_name}: {get_patch_message('sklearn', transferred_to_host=transferred_to_host)}"
72
+ )
73
+
74
+
75
+ def set_sklearn_ex_verbose():
76
+ log_level = os.environ.get("SKLEARNEX_VERBOSE")
77
+
78
+ logger = logging.getLogger("sklearnex")
79
+ logging_channel = logging.StreamHandler()
80
+ logging_formatter = logging.Formatter("%(levelname)s:%(name)s: %(message)s")
81
+ logging_channel.setFormatter(logging_formatter)
82
+ logger.addHandler(logging_channel)
83
+
84
+ try:
85
+ if log_level is not None:
86
+ logger.setLevel(log_level)
87
+ except Exception:
88
+ warnings.warn(
89
+ 'Unknown level "{}" for logging.\n'
90
+ 'Please, use one of "CRITICAL", "ERROR", '
91
+ '"WARNING", "INFO", "DEBUG".'.format(log_level)
92
+ )
93
+
94
+
95
+ def get_patch_message(s, queue=None, transferred_to_host=True):
96
+ if s == "onedal":
97
+ message = "running accelerated version on "
98
+ if queue is not None:
99
+ if queue.sycl_device.is_gpu:
100
+ message += "GPU"
101
+ elif queue.sycl_device.is_cpu:
102
+ message += "CPU"
103
+ else:
104
+ raise RuntimeError("Unsupported device")
105
+ else:
106
+ message += "CPU"
107
+ elif s == "sklearn":
108
+ message = "fallback to original Scikit-learn"
109
+ elif s == "sklearn_after_onedal":
110
+ message = "failed to run accelerated version, fallback to original Scikit-learn"
111
+ else:
112
+ raise ValueError(
113
+ f"Invalid input - expected one of 'onedal','sklearn',"
114
+ f" 'sklearn_after_onedal', got {s}"
115
+ )
116
+ if transferred_to_host:
117
+ message += (
118
+ ". All input data transferred to host for further backend computations."
119
+ )
120
+ return message
121
+
122
+
123
+ def get_sklearnex_version(rule):
124
+ return daal_check_version(rule)
125
+
126
+
127
+ def register_hyperparameters(hyperparameters_map):
128
+ """Decorator for hyperparameters support in estimator class.
129
+
130
+ Adds `get_hyperparameters` and `reset_hyperparameters` methods to class.
131
+
132
+ Parameters
133
+ ----------
134
+ hyperparameters_map : Dict[str, Tuple[str, str]]
135
+ Dictionary containing the mapping of the operator name in the sklearnex API
136
+ to the tuple (algorithm name, operation name) that contains the arguments to
137
+ onedal.common.hyperparameters.get_hyperparameters and
138
+ onedal.common.hyperparameters.reset_hyperparameters functions.
139
+
140
+ Returns
141
+ -------
142
+ decorator : function
143
+ Function which adds `get_hyperparameters` method to classes.
144
+ """
145
+
146
+ def decorator(cls):
147
+ """Add ``get_hyperparameters()` static method to a class.
148
+
149
+ Parameters
150
+ ----------
151
+ cls : class
152
+ Class to be modified.
153
+
154
+ Returns
155
+ -------
156
+ cls : class
157
+ Class with added `get_hyperparameters` method.
158
+ """
159
+
160
+ class StaticHyperparametersAccessor:
161
+ """Like a @staticmethod, but additionally raises a Warning when called on an instance."""
162
+
163
+ def __get__(self, instance, _):
164
+ if instance is not None:
165
+ warnings.warn(
166
+ "Hyperparameters are static variables and can not be modified per instance."
167
+ )
168
+ return self.get_hyperparameters
169
+
170
+ def get_hyperparameters(self, op):
171
+ return onedal_get_hyperparameters(
172
+ hyperparameters_map[op][0], hyperparameters_map[op][1]
173
+ )
174
+
175
+ class StaticHyperparametersResetter:
176
+ """Like a @staticmethod, but additionally raises a Warning when called on an instance."""
177
+
178
+ def __get__(self, instance, _):
179
+ if instance is not None:
180
+ warnings.warn(
181
+ "Hyperparameters are static variables and can not be modified per instance."
182
+ )
183
+ return self.reset_hyperparameters
184
+
185
+ def reset_hyperparameters(self, op):
186
+ return onedal_reset_hyperparameters(
187
+ hyperparameters_map[op][0], hyperparameters_map[op][1]
188
+ )
189
+
190
+ cls.get_hyperparameters = StaticHyperparametersAccessor()
191
+ cls.reset_hyperparameters = StaticHyperparametersResetter()
192
+ return cls
193
+
194
+ return decorator
195
+
196
+
197
+ def _add_inc_serialization_note(class_docstrings: str) -> str:
198
+ """Adds a small note note about serialization for extension estimators that are incremental.
199
+ The class docstrings should leave a placeholder '%incremental_serialization_note%' inside
200
+ their docstrings, which will be replaced by this note.
201
+ """
202
+ # In python versions >=3.13, leading whitespace in docstrings defined through
203
+ # static strings (but **not through other ways**) is automatically removed
204
+ # from the final docstrings, while in earlier versions is kept.
205
+ inc_serialization_note = """Note
206
+ ----
207
+ Serializing instances of this class will trigger a forced finalization of calculations
208
+ when the inputs are in a sycl queue or when using GPUs. Since (internal method)
209
+ finalize_fit can't be dispatched without directly provided queue and the dispatching
210
+ policy can't be serialized, the computation is finalized during serialization call and
211
+ the policy is not saved in serialized data."""
212
+ if sys.version_info.major == 3 and sys.version_info.minor <= 12:
213
+ inc_serialization_note = re.sub(
214
+ r"^", " " * 4, inc_serialization_note, flags=re.MULTILINE
215
+ )
216
+ inc_serialization_note = inc_serialization_note.strip()
217
+ return class_docstrings.replace(
218
+ r"%incremental_serialization_note%", inc_serialization_note
219
+ )
@@ -0,0 +1,109 @@
1
+ # ===============================================================================
2
+ # Copyright contributors to the oneDAL project
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 sklearn.base import BaseEstimator
18
+
19
+ from daal4py.sklearn._utils import sklearn_check_version
20
+
21
+ if sklearn_check_version("1.6"):
22
+ from dataclasses import dataclass, fields
23
+
24
+ from sklearn.utils import Tags as _sklearn_Tags
25
+
26
+ @dataclass
27
+ class Tags(_sklearn_Tags):
28
+ onedal_array_api: bool = False
29
+
30
+
31
+ class oneDALEstimator:
32
+ """Inherited class for all oneDAL-based estimators.
33
+
34
+ This class must be inherited before any scikit-learn estimator
35
+ classes (i.e. those which inherit from scikit-learn's BaseEstimator).
36
+
37
+ It enables:
38
+
39
+ - dispatching to oneDAL
40
+ - html documentation
41
+
42
+ Notes
43
+ -----
44
+ Sklearnex-only estimators must inherit this class directly before
45
+ BaseEstimator in order to properly render documentation. Other
46
+ sklearn classes like Mixins can be before this class in the MRO
47
+ without any impact on functionality.
48
+ """
49
+
50
+ if sklearn_check_version("1.6"):
51
+ # Starting in sklearn 1.6, _more_tags is deprecated. An oneDALEstimator
52
+ # is defined to handle the various versioning issues with the tags and
53
+ # with the ongoing rollout of sklearn's array_api support. This will make
54
+ # maintenance easier, and centralize tag changes to a single location.
55
+
56
+ def __sklearn_tags__(self) -> Tags:
57
+ # This convention is unnecessarily restrictive with more performant
58
+ # alternatives but it best follows sklearn. Subclasses will now only need
59
+ # to set `onedal_array_api` to True to signify gpu zero-copy support
60
+ # and maintenance is smaller because of underlying sklearn infrastructure
61
+ sktags = super().__sklearn_tags__()
62
+ tag_dict = {
63
+ field.name: getattr(sktags, field.name) for field in fields(sktags)
64
+ }
65
+ return Tags(**tag_dict)
66
+
67
+ elif sklearn_check_version("1.3"):
68
+
69
+ def _more_tags(self) -> dict[bool]:
70
+ return {"onedal_array_api": False}
71
+
72
+ else:
73
+ # array_api_support tag was added in sklearn 1.3 via scikit-learn/scikit-learn#26372
74
+ def _more_tags(self) -> dict[bool, bool]:
75
+ return {"array_api_support": False, "onedal_array_api": False}
76
+
77
+ if sklearn_check_version("1.4"):
78
+
79
+ @property
80
+ def _doc_link_module(self) -> str:
81
+ return "sklearnex"
82
+
83
+ def _doc_link_url_param_generator(self, *_) -> dict[str, str]:
84
+ return {
85
+ "estimator_module": "sklearn."
86
+ + self.__class__.__module__.rsplit(".", 2)[-2],
87
+ "estimator_name": self.__class__.__name__,
88
+ }
89
+
90
+ def _get_doc_link(self) -> str:
91
+ # This method is meant to generate a clickable doc link for classes
92
+ # in sklearnex including those that are not part of base scikit-learn.
93
+ # It should be inherited before inheriting from a scikit-learn estimator.
94
+
95
+ mro = self.__class__.__mro__
96
+ # The next object in the Estimators MRO after oneDALEstimator should be
97
+ # the equivalent sklearn estimator, if it is BaseEstimator, it is a
98
+ # sklearnex-only estimator.
99
+ url = BaseEstimator._get_doc_link(self)
100
+ if (
101
+ url
102
+ and oneDALEstimator in mro
103
+ and mro[mro.index(oneDALEstimator) + 1] is BaseEstimator
104
+ ):
105
+ module_path, _ = self.__class__.__module__.rsplit(".", 1)
106
+ class_name = self.__class__.__name__
107
+ url = f"https://uxlfoundation.github.io/scikit-learn-intelex/latest/non-scikit-algorithms.html#{module_path}.{class_name}"
108
+
109
+ return url