scikit-learn-intelex 2024.0.1__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 (275) 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-2024.0.1.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn}/cluster/__init__.py +3 -3
  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.0.1.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/__init__.py +4 -2
  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.0.1.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn}/linear_model/__init__.py +29 -30
  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-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +17 -0
  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.0.1.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/manifold}/__init__.py +4 -3
  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-2024.0.1.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +4 -3
  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.0.1.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.0.1.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.0.1.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-2024.0.1.data/data/Lib/site-packages/sklearnex/spmd/linear_model → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils}/__init__.py +5 -3
  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-2025.1.0.data/data/Lib/site-packages/onedal/covariance/__init__.py +20 -0
  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.0.1.data/data/Lib/site-packages/sklearnex/basic_statistics → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition}/__init__.py +3 -3
  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.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__init__.py +12 -7
  130. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__main__.py +0 -1
  131. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_config.py +22 -16
  132. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +126 -0
  133. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_utils.py +42 -5
  134. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
  135. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +230 -0
  136. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +345 -0
  137. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +270 -0
  138. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +404 -0
  139. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/__init__.py +1 -2
  140. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/dbscan.py +18 -8
  141. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +395 -0
  142. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +8 -7
  143. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +159 -0
  144. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
  145. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
  146. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +398 -0
  147. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +237 -0
  148. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/decomposition/__init__.py +0 -1
  149. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +425 -0
  150. scikit_learn_intelex-2024.0.1.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 +26 -6
  151. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/dispatcher.py +242 -28
  152. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/__init__.py +0 -1
  153. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/_forest.py +262 -180
  154. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +39 -22
  155. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/__main__.py +0 -1
  156. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/dispatcher.py +16 -3
  157. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
  158. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +13 -1
  159. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +482 -0
  160. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +425 -0
  161. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +341 -0
  162. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_regression.py +413 -0
  163. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py +24 -0
  164. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +207 -0
  165. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +153 -0
  166. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
  167. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +134 -0
  168. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/__init__.py +0 -1
  169. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py +21 -0
  170. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +0 -1
  171. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/__init__.py +0 -1
  172. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/pairwise.py +5 -1
  173. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/ranking.py +3 -1
  174. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +0 -1
  175. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/__init__.py +0 -1
  176. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/split.py +5 -1
  177. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +0 -1
  178. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/__init__.py +1 -2
  179. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +236 -0
  180. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/common.py +54 -8
  181. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +51 -151
  182. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +46 -146
  183. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +53 -95
  184. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +16 -19
  185. {scikit_learn_intelex-2024.0.1.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
  186. {scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/decomposition → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance}/__init__.py +19 -20
  187. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +138 -0
  188. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +66 -0
  189. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
  190. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +233 -0
  191. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +266 -0
  192. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/__init__.py +19 -18
  193. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/ridge.py +424 -0
  194. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_ridge.py +102 -0
  195. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/__init__.py +1 -0
  196. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
  197. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
  198. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +107 -0
  199. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +307 -0
  200. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +97 -0
  201. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +172 -0
  202. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
  203. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +21 -0
  204. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +37 -0
  205. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +107 -0
  206. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +184 -0
  207. {scikit_learn_intelex-2024.0.1.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
  208. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +30 -0
  209. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +269 -0
  210. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +128 -0
  211. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +4 -12
  212. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +265 -0
  213. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +21 -0
  214. scikit_learn_intelex-2024.0.1.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
  215. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
  216. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +329 -0
  217. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +145 -0
  218. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +162 -0
  219. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +288 -0
  220. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/__init__.py +0 -1
  221. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +339 -0
  222. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvc.py +172 -73
  223. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvr.py +73 -66
  224. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svc.py +171 -73
  225. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svr.py +65 -62
  226. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +12 -21
  227. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +390 -0
  228. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +123 -0
  229. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +379 -0
  230. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +276 -0
  231. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +108 -0
  232. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/tests/test_parallel.py +6 -8
  233. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +385 -0
  234. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +321 -0
  235. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +44 -0
  236. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +371 -0
  237. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
  238. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +82 -0
  239. scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_finite.py +89 -0
  240. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/validation.py +0 -1
  241. {scikit_learn_intelex-2024.0.1.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/METADATA +231 -230
  242. scikit_learn_intelex-2025.1.0.dist-info/RECORD +257 -0
  243. {scikit_learn_intelex-2024.0.1.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/WHEEL +1 -1
  244. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/_device_offload.py +0 -223
  245. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +0 -18
  246. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +0 -31
  247. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +0 -18
  248. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +0 -28
  249. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +0 -373
  250. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/linear_model/logistic_path.py +0 -18
  251. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +0 -77
  252. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +0 -29
  253. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/neighbors/lof.py +0 -437
  254. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/cluster/_common.py +0 -84
  255. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/cluster/k_means.py +0 -370
  256. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/preview/decomposition/pca.py +0 -376
  257. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/svm/_common.py +0 -188
  258. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +0 -225
  259. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +0 -210
  260. scikit_learn_intelex-2024.0.1.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability_tests.py +0 -428
  261. scikit_learn_intelex-2024.0.1.dist-info/RECORD +0 -90
  262. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +0 -0
  263. {scikit_learn_intelex-2024.0.1.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.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +0 -0
  265. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +0 -0
  266. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +0 -0
  267. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +0 -0
  268. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +0 -0
  269. {scikit_learn_intelex-2024.0.1.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.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +0 -0
  271. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/neighbors.py +0 -0
  272. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/__init__.py +0 -0
  273. {scikit_learn_intelex-2024.0.1.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/parallel.py +0 -0
  274. {scikit_learn_intelex-2024.0.1.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/LICENSE.txt +0 -0
  275. {scikit_learn_intelex-2024.0.1.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,693 @@
1
+ # ==============================================================================
2
+ # Copyright 2014 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 contextlib import suppress
19
+
20
+ import numpy as np
21
+ import scipy.sparse as sp
22
+
23
+ if np.lib.NumpyVersion(np.__version__) >= np.lib.NumpyVersion("2.0.0a0"):
24
+ # numpy_version >= 2.0
25
+ from numpy.exceptions import ComplexWarning
26
+ else:
27
+ # numpy_version < 2.0
28
+ from numpy.core.numeric import ComplexWarning
29
+
30
+ from sklearn import get_config as _get_config
31
+ from sklearn.utils.extmath import _safe_accumulator_op
32
+ from sklearn.utils.fixes import _object_dtype_isnan
33
+ from sklearn.utils.validation import _assert_all_finite as _sklearn_assert_all_finite
34
+ from sklearn.utils.validation import (
35
+ _ensure_no_complex_data,
36
+ _ensure_sparse_format,
37
+ _num_samples,
38
+ check_consistent_length,
39
+ column_or_1d,
40
+ )
41
+
42
+ import daal4py as d4p
43
+
44
+ from .._utils import (
45
+ PatchingConditionsChain,
46
+ get_dtype,
47
+ get_number_of_types,
48
+ is_DataFrame,
49
+ sklearn_check_version,
50
+ )
51
+
52
+
53
+ def _assert_all_finite(
54
+ X, allow_nan=False, msg_dtype=None, estimator_name=None, input_name=""
55
+ ):
56
+ if _get_config()["assume_finite"]:
57
+ return
58
+
59
+ # Data with small size has too big relative overhead
60
+ # TODO: tune threshold size
61
+ if hasattr(X, "size"):
62
+ if X.size < 32768:
63
+ if sklearn_check_version("1.1"):
64
+ _sklearn_assert_all_finite(
65
+ X,
66
+ allow_nan=allow_nan,
67
+ msg_dtype=msg_dtype,
68
+ estimator_name=estimator_name,
69
+ input_name=input_name,
70
+ )
71
+ else:
72
+ _sklearn_assert_all_finite(X, allow_nan=allow_nan, msg_dtype=msg_dtype)
73
+ return
74
+
75
+ is_df = is_DataFrame(X)
76
+ num_of_types = get_number_of_types(X)
77
+
78
+ # if X is heterogeneous pandas.DataFrame then
79
+ # covert it to a list of arrays
80
+ if is_df and num_of_types > 1:
81
+ lst = []
82
+ for idx in X:
83
+ arr = X[idx].to_numpy()
84
+ lst.append(arr if arr.flags["C_CONTIGUOUS"] else np.ascontiguousarray(arr))
85
+ else:
86
+ X = np.asanyarray(X)
87
+ is_df = False
88
+
89
+ dt = np.dtype(get_dtype(X))
90
+ is_float = dt.kind in "fc"
91
+
92
+ msg_err = "Input {} contains {} or a value too large for {!r}."
93
+ type_err = "infinity" if allow_nan else "NaN, infinity"
94
+ err = msg_err.format(input_name, type_err, msg_dtype if msg_dtype is not None else dt)
95
+
96
+ _patching_status = PatchingConditionsChain(
97
+ "sklearn.utils.validation._assert_all_finite"
98
+ )
99
+ _dal_ready = _patching_status.and_conditions(
100
+ [
101
+ (X.ndim in [1, 2], "X has not 1 or 2 dimensions."),
102
+ (not np.any(np.equal(X.shape, 0)), "X shape contains 0."),
103
+ (dt in [np.float32, np.float64], "X dtype is not float32 or float64."),
104
+ ]
105
+ )
106
+ _patching_status.write_log()
107
+ if _dal_ready:
108
+ if X.ndim == 1:
109
+ X = X.reshape((-1, 1))
110
+
111
+ x_for_daal = lst if is_df and num_of_types > 1 else X
112
+
113
+ if dt == np.float64:
114
+ if not d4p.daal_assert_all_finite(x_for_daal, allow_nan, 0):
115
+ raise ValueError(err)
116
+ elif dt == np.float32:
117
+ if not d4p.daal_assert_all_finite(x_for_daal, allow_nan, 1):
118
+ raise ValueError(err)
119
+ # First try an O(n) time, O(1) space solution for the common case that
120
+ # everything is finite; fall back to O(n) space np.isfinite to prevent
121
+ # false positives from overflow in sum method. The sum is also calculated
122
+ # safely to reduce dtype induced overflows.
123
+ elif is_float and (np.isfinite(_safe_accumulator_op(np.sum, X))):
124
+ pass
125
+ elif is_float:
126
+ if allow_nan and np.isinf(X).any() or not allow_nan and not np.isfinite(X).all():
127
+ raise ValueError(err)
128
+ # for object dtype data, we only check for NaNs (GH-13254)
129
+ elif dt == np.dtype("object") and not allow_nan:
130
+ if _object_dtype_isnan(X).any():
131
+ raise ValueError(f"Input {input_name} contains NaN")
132
+
133
+
134
+ def _pandas_check_array(
135
+ array,
136
+ array_orig,
137
+ force_all_finite,
138
+ ensure_min_samples,
139
+ ensure_min_features,
140
+ copy,
141
+ context,
142
+ ):
143
+ if force_all_finite:
144
+ _assert_all_finite(array, allow_nan=force_all_finite == "allow-nan")
145
+
146
+ if ensure_min_samples > 0:
147
+ n_samples = _num_samples(array)
148
+ if n_samples < ensure_min_samples:
149
+ raise ValueError(
150
+ "Found array with %d sample(s) (shape=%s) while a"
151
+ " minimum of %d is required%s."
152
+ % (n_samples, array.shape, ensure_min_samples, context)
153
+ )
154
+
155
+ if ensure_min_features > 0:
156
+ n_features = array.shape[1]
157
+ if n_features < ensure_min_features:
158
+ raise ValueError(
159
+ "Found array with %d feature(s) (shape=%s) while"
160
+ " a minimum of %d is required%s."
161
+ % (n_features, array.shape, ensure_min_features, context)
162
+ )
163
+
164
+ if copy and np.may_share_memory(array, array_orig):
165
+ array = array.copy()
166
+
167
+ return array
168
+
169
+
170
+ def _daal_check_array(
171
+ array,
172
+ accept_sparse=False,
173
+ *,
174
+ accept_large_sparse=True,
175
+ dtype="numeric",
176
+ order=None,
177
+ copy=False,
178
+ force_all_finite=True,
179
+ ensure_2d=True,
180
+ allow_nd=False,
181
+ ensure_min_samples=1,
182
+ ensure_min_features=1,
183
+ estimator=None,
184
+ ):
185
+ """Input validation on an array, list, sparse matrix or similar.
186
+
187
+ By default, the input is checked to be a non-empty 2D array containing
188
+ only finite values. If the dtype of the array is object, attempt
189
+ converting to float, raising on failure.
190
+
191
+ Parameters
192
+ ----------
193
+ array : object
194
+ Input object to check / convert.
195
+
196
+ accept_sparse : string, boolean or list/tuple of strings (default=False)
197
+ String[s] representing allowed sparse matrix formats, such as 'csc',
198
+ 'csr', etc. If the input is sparse but not in the allowed format,
199
+ it will be converted to the first listed format. True allows the input
200
+ to be any format. False means that a sparse matrix input will
201
+ raise an error.
202
+
203
+ accept_large_sparse : bool (default=True)
204
+ If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by
205
+ accept_sparse, accept_large_sparse=False will cause it to be accepted
206
+ only if its indices are stored with a 32-bit dtype.
207
+
208
+ .. versionadded:: 0.20
209
+
210
+ dtype : string, type, list of types or None (default="numeric")
211
+ Data type of result. If None, the dtype of the input is preserved.
212
+ If "numeric", dtype is preserved unless array.dtype is object.
213
+ If dtype is a list of types, conversion on the first type is only
214
+ performed if the dtype of the input is not in the list.
215
+
216
+ order : 'F', 'C' or None (default=None)
217
+ Whether an array will be forced to be fortran or c-style.
218
+ When order is None (default), then if copy=False, nothing is ensured
219
+ about the memory layout of the output array; otherwise (copy=True)
220
+ the memory layout of the returned array is kept as close as possible
221
+ to the original array.
222
+
223
+ copy : boolean (default=False)
224
+ Whether a forced copy will be triggered. If copy=False, a copy might
225
+ be triggered by a conversion.
226
+
227
+ force_all_finite : boolean or 'allow-nan', (default=True)
228
+ Whether to raise an error on np.inf, np.nan, pd.NA in array. The
229
+ possibilities are:
230
+
231
+ - True: Force all values of array to be finite.
232
+ - False: accepts np.inf, np.nan, pd.NA in array.
233
+ - 'allow-nan': accepts only np.nan and pd.NA values in array. Values
234
+ cannot be infinite.
235
+
236
+ .. versionadded:: 0.20
237
+ ``force_all_finite`` accepts the string ``'allow-nan'``.
238
+
239
+ .. versionchanged:: 0.23
240
+ Accepts `pd.NA` and converts it into `np.nan`
241
+
242
+ ensure_2d : boolean (default=True)
243
+ Whether to raise a value error if array is not 2D.
244
+
245
+ allow_nd : boolean (default=False)
246
+ Whether to allow array.ndim > 2.
247
+
248
+ ensure_min_samples : int (default=1)
249
+ Make sure that the array has a minimum number of samples in its first
250
+ axis (rows for a 2D array). Setting to 0 disables this check.
251
+
252
+ ensure_min_features : int (default=1)
253
+ Make sure that the 2D array has some minimum number of features
254
+ (columns). The default value of 1 rejects empty datasets.
255
+ This check is only enforced when the input data has effectively 2
256
+ dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0
257
+ disables this check.
258
+
259
+ estimator : str or estimator instance (default=None)
260
+ If passed, include the name of the estimator in warning messages.
261
+
262
+ Returns
263
+ -------
264
+ array_converted : object
265
+ The converted and validated array.
266
+ """
267
+ if force_all_finite not in (True, False, "allow-nan"):
268
+ raise ValueError(
269
+ 'force_all_finite should be a bool or "allow-nan"'
270
+ ". Got {!r} instead".format(force_all_finite)
271
+ )
272
+
273
+ if estimator is not None:
274
+ if isinstance(estimator, str):
275
+ estimator_name = estimator
276
+ else:
277
+ estimator_name = estimator.__class__.__name__
278
+ else:
279
+ estimator_name = "Estimator"
280
+ context = " by %s" % estimator_name if estimator is not None else ""
281
+
282
+ array_orig = array
283
+
284
+ # a branch for heterogeneous pandas.DataFrame
285
+ if is_DataFrame(array) and get_number_of_types(array) > 1:
286
+ from pandas import SparseDtype
287
+
288
+ def is_sparse(dtype):
289
+ return isinstance(dtype, SparseDtype)
290
+
291
+ if hasattr(array, "sparse") or not array.dtypes.apply(is_sparse).any():
292
+ return _pandas_check_array(
293
+ array,
294
+ array_orig,
295
+ force_all_finite,
296
+ ensure_min_samples,
297
+ ensure_min_features,
298
+ copy,
299
+ context,
300
+ )
301
+
302
+ # store whether originally we wanted numeric dtype
303
+ dtype_numeric = isinstance(dtype, str) and dtype == "numeric"
304
+
305
+ dtype_orig = getattr(array, "dtype", None)
306
+ if not hasattr(dtype_orig, "kind"):
307
+ # not a data type (e.g. a column named dtype in a pandas DataFrame)
308
+ dtype_orig = None
309
+
310
+ # check if the object contains several dtypes (typically a pandas
311
+ # DataFrame), and store them. If not, store None.
312
+ dtypes_orig = None
313
+ has_pd_integer_array = False
314
+ if hasattr(array, "dtypes") and hasattr(array.dtypes, "__array__"):
315
+ # throw warning if columns are sparse. If all columns are sparse, then
316
+ # array.sparse exists and sparsity will be perserved (later).
317
+ with suppress(ImportError):
318
+ from pandas import SparseDtype
319
+
320
+ def is_sparse(dtype):
321
+ return isinstance(dtype, SparseDtype)
322
+
323
+ if not hasattr(array, "sparse") and array.dtypes.apply(is_sparse).any():
324
+ warnings.warn(
325
+ "pandas.DataFrame with sparse columns found."
326
+ "It will be converted to a dense numpy array."
327
+ )
328
+
329
+ dtypes_orig = list(array.dtypes)
330
+ # pandas boolean dtype __array__ interface coerces bools to objects
331
+ for i, dtype_iter in enumerate(dtypes_orig):
332
+ if dtype_iter.kind == "b":
333
+ dtypes_orig[i] = np.dtype(np.object)
334
+ elif dtype_iter.name.startswith(("Int", "UInt")):
335
+ # name looks like an Integer Extension Array, now check for
336
+ # the dtype
337
+ with suppress(ImportError):
338
+ from pandas import (
339
+ Int8Dtype,
340
+ Int16Dtype,
341
+ Int32Dtype,
342
+ Int64Dtype,
343
+ UInt8Dtype,
344
+ UInt16Dtype,
345
+ UInt32Dtype,
346
+ UInt64Dtype,
347
+ )
348
+
349
+ if isinstance(
350
+ dtype_iter,
351
+ (
352
+ Int8Dtype,
353
+ Int16Dtype,
354
+ Int32Dtype,
355
+ Int64Dtype,
356
+ UInt8Dtype,
357
+ UInt16Dtype,
358
+ UInt32Dtype,
359
+ UInt64Dtype,
360
+ ),
361
+ ):
362
+ has_pd_integer_array = True
363
+
364
+ if all(isinstance(dtype, np.dtype) for dtype in dtypes_orig):
365
+ dtype_orig = np.result_type(*dtypes_orig)
366
+
367
+ if dtype_numeric:
368
+ if dtype_orig is not None and dtype_orig.kind == "O":
369
+ # if input is object, convert to float.
370
+ dtype = np.float64
371
+ else:
372
+ dtype = None
373
+
374
+ if isinstance(dtype, (list, tuple)):
375
+ if dtype_orig is not None and dtype_orig in dtype:
376
+ # no dtype conversion required
377
+ dtype = None
378
+ else:
379
+ # dtype conversion required. Let's select the first element of the
380
+ # list of accepted types.
381
+ dtype = dtype[0]
382
+
383
+ if has_pd_integer_array:
384
+ # If there are any pandas integer extension arrays,
385
+ array = array.astype(dtype)
386
+
387
+ # When all dataframe columns are sparse, convert to a sparse array
388
+ if hasattr(array, "sparse") and array.ndim > 1:
389
+ # DataFrame.sparse only supports `to_coo`
390
+ array = array.sparse.to_coo()
391
+
392
+ if sp.issparse(array):
393
+ _ensure_no_complex_data(array)
394
+ array = _ensure_sparse_format(
395
+ array,
396
+ accept_sparse=accept_sparse,
397
+ dtype=dtype,
398
+ copy=copy,
399
+ force_all_finite=force_all_finite,
400
+ accept_large_sparse=accept_large_sparse,
401
+ )
402
+ else:
403
+ # If np.array(..) gives ComplexWarning, then we convert the warning
404
+ # to an error. This is needed because specifying a non complex
405
+ # dtype to the function converts complex to real dtype,
406
+ # thereby passing the test made in the lines following the scope
407
+ # of warnings context manager.
408
+ with warnings.catch_warnings():
409
+ try:
410
+ warnings.simplefilter("error", ComplexWarning)
411
+ if dtype is not None and np.dtype(dtype).kind in "iu":
412
+ # Conversion float -> int should not contain NaN or
413
+ # inf (numpy#14412). We cannot use casting='safe' because
414
+ # then conversion float -> int would be disallowed.
415
+ array = np.asarray(array, order=order)
416
+ if array.dtype.kind == "f":
417
+ _assert_all_finite(array, allow_nan=False, msg_dtype=dtype)
418
+ array = array.astype(dtype, casting="unsafe", copy=False)
419
+ else:
420
+ array = np.asarray(array, order=order, dtype=dtype)
421
+ except ComplexWarning:
422
+ raise ValueError("Complex data not supported\n" "{}\n".format(array))
423
+
424
+ # It is possible that the np.array(..) gave no warning. This happens
425
+ # when no dtype conversion happened, for example dtype = None. The
426
+ # result is that np.array(..) produces an array of complex dtype
427
+ # and we need to catch and raise exception for such cases.
428
+ _ensure_no_complex_data(array) # doing nothing for DataFrame
429
+
430
+ if ensure_2d:
431
+ # If input is scalar raise error
432
+ if array.ndim == 0:
433
+ raise ValueError(
434
+ "Expected 2D array, got scalar array instead:\narray={}.\n"
435
+ "Reshape your data either using array.reshape(-1, 1) if "
436
+ "your data has a single feature or array.reshape(1, -1) "
437
+ "if it contains a single sample.".format(array)
438
+ )
439
+ # If input is 1D raise error
440
+ if array.ndim == 1:
441
+ raise ValueError(
442
+ "Expected 2D array, got 1D array instead:\narray={}.\n"
443
+ "Reshape your data either using array.reshape(-1, 1) if "
444
+ "your data has a single feature or array.reshape(1, -1) "
445
+ "if it contains a single sample.".format(array)
446
+ )
447
+
448
+ # in the future np.flexible dtypes will be handled like object dtypes
449
+ if dtype_numeric and np.issubdtype(array.dtype, np.flexible):
450
+ warnings.warn(
451
+ "Beginning in version 0.22, arrays of bytes/strings will be "
452
+ "converted to decimal numbers if dtype='numeric'. "
453
+ "It is recommended that you convert the array to "
454
+ "a float dtype before using it in scikit-learn, "
455
+ "for example by using "
456
+ "your_array = your_array.astype(np.float64).",
457
+ FutureWarning,
458
+ stacklevel=2,
459
+ )
460
+
461
+ # make sure we actually converted to numeric:
462
+ if dtype_numeric and array.dtype.kind == "O":
463
+ array = array.astype(np.float64)
464
+ if not allow_nd and array.ndim >= 3:
465
+ raise ValueError(
466
+ "Found array with dim %d. %s expected <= 2."
467
+ % (array.ndim, estimator_name)
468
+ )
469
+
470
+ if force_all_finite:
471
+ _assert_all_finite(array, allow_nan=force_all_finite == "allow-nan")
472
+
473
+ if ensure_min_samples > 0:
474
+ n_samples = _num_samples(array)
475
+ if n_samples < ensure_min_samples:
476
+ raise ValueError(
477
+ "Found array with %d sample(s) (shape=%s) while a"
478
+ " minimum of %d is required%s."
479
+ % (n_samples, array.shape, ensure_min_samples, context)
480
+ )
481
+
482
+ if ensure_min_features > 0 and array.ndim == 2:
483
+ n_features = array.shape[1]
484
+ if n_features < ensure_min_features:
485
+ raise ValueError(
486
+ "Found array with %d feature(s) (shape=%s) while"
487
+ " a minimum of %d is required%s."
488
+ % (n_features, array.shape, ensure_min_features, context)
489
+ )
490
+
491
+ if copy and np.may_share_memory(array, array_orig):
492
+ array = np.array(array, dtype=dtype, order=order)
493
+
494
+ return array
495
+
496
+
497
+ def _daal_check_X_y(
498
+ X,
499
+ y,
500
+ accept_sparse=False,
501
+ *,
502
+ accept_large_sparse=True,
503
+ dtype="numeric",
504
+ order=None,
505
+ copy=False,
506
+ force_all_finite=True,
507
+ ensure_2d=True,
508
+ allow_nd=False,
509
+ multi_output=False,
510
+ ensure_min_samples=1,
511
+ ensure_min_features=1,
512
+ y_numeric=False,
513
+ estimator=None,
514
+ ):
515
+ """Input validation for standard estimators.
516
+
517
+ Checks X and y for consistent length, enforces X to be 2D and y 1D. By
518
+ default, X is checked to be non-empty and containing only finite values.
519
+ Standard input checks are also applied to y, such as checking that y
520
+ does not have np.nan or np.inf targets. For multi-label y, set
521
+ multi_output=True to allow 2D and sparse y. If the dtype of X is
522
+ object, attempt converting to float, raising on failure.
523
+
524
+ Parameters
525
+ ----------
526
+ X : nd-array, list or sparse matrix
527
+ Input data.
528
+
529
+ y : nd-array, list or sparse matrix
530
+ Labels.
531
+
532
+ accept_sparse : string, boolean or list of string (default=False)
533
+ String[s] representing allowed sparse matrix formats, such as 'csc',
534
+ 'csr', etc. If the input is sparse but not in the allowed format,
535
+ it will be converted to the first listed format. True allows the input
536
+ to be any format. False means that a sparse matrix input will
537
+ raise an error.
538
+
539
+ accept_large_sparse : bool (default=True)
540
+ If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by
541
+ accept_sparse, accept_large_sparse will cause it to be accepted only
542
+ if its indices are stored with a 32-bit dtype.
543
+
544
+ .. versionadded:: 0.20
545
+
546
+ dtype : string, type, list of types or None (default="numeric")
547
+ Data type of result. If None, the dtype of the input is preserved.
548
+ If "numeric", dtype is preserved unless array.dtype is object.
549
+ If dtype is a list of types, conversion on the first type is only
550
+ performed if the dtype of the input is not in the list.
551
+
552
+ order : 'F', 'C' or None (default=None)
553
+ Whether an array will be forced to be fortran or c-style.
554
+
555
+ copy : boolean (default=False)
556
+ Whether a forced copy will be triggered. If copy=False, a copy might
557
+ be triggered by a conversion.
558
+
559
+ force_all_finite : boolean or 'allow-nan', (default=True)
560
+ Whether to raise an error on np.inf, np.nan, pd.NA in X. This parameter
561
+ does not influence whether y can have np.inf, np.nan, pd.NA values.
562
+ The possibilities are:
563
+
564
+ - True: Force all values of X to be finite.
565
+ - False: accepts np.inf, np.nan, pd.NA in X.
566
+ - 'allow-nan': accepts only np.nan or pd.NA values in X. Values cannot
567
+ be infinite.
568
+
569
+ .. versionadded:: 0.20
570
+ ``force_all_finite`` accepts the string ``'allow-nan'``.
571
+
572
+ .. versionchanged:: 0.23
573
+ Accepts `pd.NA` and converts it into `np.nan`
574
+
575
+ ensure_2d : boolean (default=True)
576
+ Whether to raise a value error if X is not 2D.
577
+
578
+ allow_nd : boolean (default=False)
579
+ Whether to allow X.ndim > 2.
580
+
581
+ multi_output : boolean (default=False)
582
+ Whether to allow 2D y (array or sparse matrix). If false, y will be
583
+ validated as a vector. y cannot have np.nan or np.inf values if
584
+ multi_output=True.
585
+
586
+ ensure_min_samples : int (default=1)
587
+ Make sure that X has a minimum number of samples in its first
588
+ axis (rows for a 2D array).
589
+
590
+ ensure_min_features : int (default=1)
591
+ Make sure that the 2D array has some minimum number of features
592
+ (columns). The default value of 1 rejects empty datasets.
593
+ This check is only enforced when X has effectively 2 dimensions or
594
+ is originally 1D and ``ensure_2d`` is True. Setting to 0 disables
595
+ this check.
596
+
597
+ y_numeric : boolean (default=False)
598
+ Whether to ensure that y has a numeric type. If dtype of y is object,
599
+ it is converted to float64. Should only be used for regression
600
+ algorithms.
601
+
602
+ estimator : str or estimator instance (default=None)
603
+ If passed, include the name of the estimator in warning messages.
604
+
605
+ Returns
606
+ -------
607
+ X_converted : object
608
+ The converted and validated X.
609
+
610
+ y_converted : object
611
+ The converted and validated y.
612
+ """
613
+ if y is None:
614
+ raise ValueError("y cannot be None")
615
+
616
+ X = _daal_check_array(
617
+ X,
618
+ accept_sparse=accept_sparse,
619
+ accept_large_sparse=accept_large_sparse,
620
+ dtype=dtype,
621
+ order=order,
622
+ copy=copy,
623
+ force_all_finite=force_all_finite,
624
+ ensure_2d=ensure_2d,
625
+ allow_nd=allow_nd,
626
+ ensure_min_samples=ensure_min_samples,
627
+ ensure_min_features=ensure_min_features,
628
+ estimator=estimator,
629
+ )
630
+ if multi_output:
631
+ y = _daal_check_array(
632
+ y, accept_sparse="csr", force_all_finite=True, ensure_2d=False, dtype=None
633
+ )
634
+ else:
635
+ y = column_or_1d(y, warn=True)
636
+ _assert_all_finite(y)
637
+ if y_numeric and hasattr(y, "dtype") and y.dtype.kind == "O":
638
+ y = y.astype(np.float64)
639
+
640
+ check_consistent_length(X, y)
641
+
642
+ return X, y
643
+
644
+
645
+ def _daal_num_features(X):
646
+ """Return the number of features in an array-like X.
647
+ This helper function tries hard to avoid to materialize an array version
648
+ of X unless necessary. For instance, if X is a list of lists,
649
+ this function will return the length of the first element, assuming
650
+ that subsequent elements are all lists of the same length without
651
+ checking.
652
+ Parameters
653
+ ----------
654
+ X : array-like
655
+ array-like to get the number of features.
656
+ Returns
657
+ -------
658
+ features : int
659
+ Number of features
660
+ """
661
+ type_ = type(X)
662
+ if type_.__module__ == "builtins":
663
+ type_name = type_.__qualname__
664
+ else:
665
+ type_name = f"{type_.__module__}.{type_.__qualname__}"
666
+ message = f"Unable to find the number of features from X of type {type_name}"
667
+ if not hasattr(X, "__len__") and not hasattr(X, "shape"):
668
+ if not hasattr(X, "__array__"):
669
+ raise TypeError(message)
670
+ # Only convert X to a numpy array if there is no cheaper, heuristic
671
+ # option.
672
+ X = np.asarray(X)
673
+
674
+ if hasattr(X, "shape"):
675
+ if not hasattr(X.shape, "__len__") or len(X.shape) <= 1:
676
+ message += f" with shape {X.shape}"
677
+ raise TypeError(message)
678
+ return X.shape[1]
679
+
680
+ first_sample = X[0]
681
+
682
+ # Do not consider an array-like of strings or dicts to be a 2D array
683
+ if isinstance(first_sample, (str, bytes, dict)):
684
+ message += f" where the samples are of type {type(first_sample).__qualname__}"
685
+ raise TypeError(message)
686
+
687
+ try:
688
+ # If X is a list of lists, for instance, we assume that all nested
689
+ # lists have the same length without checking or converting to
690
+ # a numpy array to keep this function call as cheap as possible.
691
+ return len(first_sample)
692
+ except Exception as err:
693
+ raise TypeError(message) from err