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.
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/_daal4py.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/gbt_convertors.py +1199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/logistic_regression_builders.py +211 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/tree_based_builders.py +425 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +528 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +192 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +333 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1285 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +826 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +290 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +561 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_enet.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +432 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +259 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/_models_info.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_patching.py +90 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +493 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +136 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +736 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +772 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/__init__.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_config.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_device_offload.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +279 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/utils.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +582 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +145 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_backend.py +258 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/tests/test_sycl.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +121 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +190 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_dlpack.py +64 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_sycl_usm.py +63 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +131 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +686 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +218 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +291 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/dummy.py +137 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +781 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +201 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +230 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +293 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +171 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +690 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +202 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/svm.py +592 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +352 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +168 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/test_common.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +179 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +98 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_sycl_queue_manager.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_third_party.py +220 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/tests/test_validation.py +142 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/validation.py +503 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__init__.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_config.py +163 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +205 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_utils.py +219 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/base.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +338 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +405 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +455 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +399 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +38 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +440 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +307 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +558 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dispatcher.py +572 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +629 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/_dummy.py +615 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/tests/test_dummy.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/_forest.py +1799 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +196 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/__main__.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/dispatcher.py +101 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +44 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +427 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +363 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_regression.py +466 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +267 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +214 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_ridge.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/pairwise.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/ranking.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +39 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/split.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +34 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/common.py +313 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +170 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/__init__.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +261 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +112 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +406 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +390 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/__init__.py +25 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +314 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +26 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +108 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +180 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +120 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +200 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +276 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +146 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +345 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +162 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +169 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +433 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +403 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvc.py +278 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvr.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svc.py +306 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svr.py +155 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +607 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_hyperparameters.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_parallel.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +418 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +420 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +217 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/class_weight.py +100 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/parallel.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_class_weight.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_validation.py +238 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/validation.py +212 -0
- scikit_learn_intelex-2025.10.0.dist-info/LICENSE.txt +202 -0
- scikit_learn_intelex-2025.10.0.dist-info/METADATA +182 -0
- scikit_learn_intelex-2025.10.0.dist-info/RECORD +267 -0
- scikit_learn_intelex-2025.10.0.dist-info/WHEEL +5 -0
- scikit_learn_intelex-2025.10.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,503 @@
|
|
|
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 inspect
|
|
18
|
+
import warnings
|
|
19
|
+
from collections.abc import Sequence
|
|
20
|
+
from numbers import Integral
|
|
21
|
+
|
|
22
|
+
import numpy as np
|
|
23
|
+
from scipy import sparse as sp
|
|
24
|
+
|
|
25
|
+
from onedal.common._backend import BackendFunction
|
|
26
|
+
from onedal.utils import _sycl_queue_manager as QM
|
|
27
|
+
|
|
28
|
+
if np.lib.NumpyVersion(np.__version__) >= np.lib.NumpyVersion("2.0.0a0"):
|
|
29
|
+
# numpy_version >= 2.0
|
|
30
|
+
from numpy.exceptions import VisibleDeprecationWarning
|
|
31
|
+
else:
|
|
32
|
+
# numpy_version < 2.0
|
|
33
|
+
from numpy import VisibleDeprecationWarning
|
|
34
|
+
|
|
35
|
+
from sklearn.preprocessing import LabelEncoder
|
|
36
|
+
from sklearn.utils.validation import check_array
|
|
37
|
+
|
|
38
|
+
from daal4py.sklearn.utils.validation import (
|
|
39
|
+
_assert_all_finite as _daal4py_assert_all_finite,
|
|
40
|
+
)
|
|
41
|
+
from onedal import _default_backend as backend
|
|
42
|
+
from onedal.datatypes import to_table
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class DataConversionWarning(UserWarning):
|
|
46
|
+
"""Warning used to notify implicit data conversions happening in the code."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _is_arraylike(x):
|
|
50
|
+
"""Returns whether the input is array-like."""
|
|
51
|
+
return hasattr(x, "__len__") or hasattr(x, "shape") or hasattr(x, "__array__")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _is_arraylike_not_scalar(array):
|
|
55
|
+
"""Return True if array is array-like and not a scalar"""
|
|
56
|
+
return _is_arraylike(array) and not np.isscalar(array)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _column_or_1d(y, warn=False):
|
|
60
|
+
y = np.asarray(y)
|
|
61
|
+
|
|
62
|
+
# TODO: Convert this kind of arrays to a table like in daal4py
|
|
63
|
+
if not y.flags.aligned and not y.flags.writeable:
|
|
64
|
+
y = np.array(y.tolist())
|
|
65
|
+
|
|
66
|
+
shape = np.shape(y)
|
|
67
|
+
if len(shape) == 1:
|
|
68
|
+
return np.ravel(y)
|
|
69
|
+
if len(shape) == 2 and shape[1] == 1:
|
|
70
|
+
if warn:
|
|
71
|
+
warnings.warn(
|
|
72
|
+
"A column-vector y was passed when a 1d array was"
|
|
73
|
+
" expected. Please change the shape of y to "
|
|
74
|
+
"(n_samples, ), for example using ravel().",
|
|
75
|
+
DataConversionWarning,
|
|
76
|
+
stacklevel=2,
|
|
77
|
+
)
|
|
78
|
+
return np.ravel(y)
|
|
79
|
+
|
|
80
|
+
raise ValueError(
|
|
81
|
+
"y should be a 1d array, " "got an array of shape {} instead.".format(shape)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _compute_class_weight(class_weight, classes, y):
|
|
86
|
+
if set(y) - set(classes):
|
|
87
|
+
raise ValueError("classes should include all valid labels that can " "be in y")
|
|
88
|
+
if class_weight is None or len(class_weight) == 0:
|
|
89
|
+
weight = np.ones(classes.shape[0], dtype=np.float64, order="C")
|
|
90
|
+
elif class_weight == "balanced":
|
|
91
|
+
y_ = _column_or_1d(y)
|
|
92
|
+
classes, _ = np.unique(y_, return_inverse=True)
|
|
93
|
+
|
|
94
|
+
le = LabelEncoder()
|
|
95
|
+
y_ind = le.fit_transform(y_)
|
|
96
|
+
if not np.isin(classes, le.classes_).all():
|
|
97
|
+
raise ValueError("classes should have valid labels that are in y")
|
|
98
|
+
|
|
99
|
+
y_bin = np.bincount(y_ind).astype(np.float64)
|
|
100
|
+
weight = len(y_) / (len(le.classes_) * y_bin)
|
|
101
|
+
else:
|
|
102
|
+
# user-defined dictionary
|
|
103
|
+
weight = np.ones(classes.shape[0], dtype=np.float64, order="C")
|
|
104
|
+
if not isinstance(class_weight, dict):
|
|
105
|
+
raise ValueError(
|
|
106
|
+
"class_weight must be dict, 'balanced', or None,"
|
|
107
|
+
" got: %r" % class_weight
|
|
108
|
+
)
|
|
109
|
+
for c in class_weight:
|
|
110
|
+
i = np.searchsorted(classes, c)
|
|
111
|
+
if i >= len(classes) or classes[i] != c:
|
|
112
|
+
raise ValueError("Class label {} not present.".format(c))
|
|
113
|
+
weight[i] = class_weight[c]
|
|
114
|
+
|
|
115
|
+
return weight
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _validate_targets(y, class_weight, dtype):
|
|
119
|
+
y_ = _column_or_1d(y, warn=True)
|
|
120
|
+
_check_classification_targets(y)
|
|
121
|
+
classes, y = np.unique(y_, return_inverse=True)
|
|
122
|
+
class_weight_res = _compute_class_weight(class_weight, classes=classes, y=y_)
|
|
123
|
+
|
|
124
|
+
if len(classes) < 2:
|
|
125
|
+
raise ValueError(
|
|
126
|
+
"The number of classes has to be greater than one; got %d"
|
|
127
|
+
" class" % len(classes)
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
return np.asarray(y, dtype=dtype, order="C"), class_weight_res, classes
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def get_finite_keyword():
|
|
134
|
+
"""Return scikit-learn-matching finite check enabling keyword.
|
|
135
|
+
|
|
136
|
+
Gets the argument name for scikit-learn's validation functions compatible with
|
|
137
|
+
the current version of scikit-learn and using function inspection instead of
|
|
138
|
+
version check due to `onedal` design rule: sklearn versioning should occur
|
|
139
|
+
in ``sklearnex`` module.
|
|
140
|
+
|
|
141
|
+
Returns
|
|
142
|
+
-------
|
|
143
|
+
finite_keyword : str
|
|
144
|
+
Keyword string used to enable finiteness checking.
|
|
145
|
+
"""
|
|
146
|
+
if "ensure_all_finite" in inspect.signature(check_array).parameters:
|
|
147
|
+
return "ensure_all_finite"
|
|
148
|
+
return "force_all_finite"
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _check_array(
|
|
152
|
+
array,
|
|
153
|
+
dtype="numeric",
|
|
154
|
+
accept_sparse=False,
|
|
155
|
+
order=None,
|
|
156
|
+
copy=False,
|
|
157
|
+
force_all_finite=True,
|
|
158
|
+
ensure_2d=True,
|
|
159
|
+
accept_large_sparse=True,
|
|
160
|
+
_finite_keyword=get_finite_keyword(),
|
|
161
|
+
):
|
|
162
|
+
if force_all_finite:
|
|
163
|
+
if sp.issparse(array):
|
|
164
|
+
if hasattr(array, "data"):
|
|
165
|
+
_daal4py_assert_all_finite(array.data)
|
|
166
|
+
force_all_finite = False
|
|
167
|
+
else:
|
|
168
|
+
_daal4py_assert_all_finite(array)
|
|
169
|
+
force_all_finite = False
|
|
170
|
+
check_kwargs = {
|
|
171
|
+
"array": array,
|
|
172
|
+
"dtype": dtype,
|
|
173
|
+
"accept_sparse": accept_sparse,
|
|
174
|
+
"order": order,
|
|
175
|
+
"copy": copy,
|
|
176
|
+
"ensure_2d": ensure_2d,
|
|
177
|
+
"accept_large_sparse": accept_large_sparse,
|
|
178
|
+
}
|
|
179
|
+
check_kwargs[_finite_keyword] = force_all_finite
|
|
180
|
+
|
|
181
|
+
array = check_array(
|
|
182
|
+
**check_kwargs,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
if sp.issparse(array):
|
|
186
|
+
return array
|
|
187
|
+
return array
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _check_X_y(
|
|
191
|
+
X,
|
|
192
|
+
y,
|
|
193
|
+
dtype="numeric",
|
|
194
|
+
accept_sparse=False,
|
|
195
|
+
order=None,
|
|
196
|
+
copy=False,
|
|
197
|
+
force_all_finite=True,
|
|
198
|
+
ensure_2d=True,
|
|
199
|
+
accept_large_sparse=True,
|
|
200
|
+
y_numeric=False,
|
|
201
|
+
accept_2d_y=False,
|
|
202
|
+
):
|
|
203
|
+
if y is None:
|
|
204
|
+
raise ValueError("y cannot be None")
|
|
205
|
+
|
|
206
|
+
X = _check_array(
|
|
207
|
+
X,
|
|
208
|
+
accept_sparse=accept_sparse,
|
|
209
|
+
dtype=dtype,
|
|
210
|
+
order=order,
|
|
211
|
+
copy=copy,
|
|
212
|
+
force_all_finite=force_all_finite,
|
|
213
|
+
ensure_2d=ensure_2d,
|
|
214
|
+
accept_large_sparse=accept_large_sparse,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
if not accept_2d_y:
|
|
218
|
+
y = _column_or_1d(y, warn=True)
|
|
219
|
+
else:
|
|
220
|
+
y = np.ascontiguousarray(y)
|
|
221
|
+
|
|
222
|
+
if y_numeric and y.dtype.kind == "O":
|
|
223
|
+
y = y.astype(np.float64)
|
|
224
|
+
if force_all_finite:
|
|
225
|
+
_daal4py_assert_all_finite(y)
|
|
226
|
+
|
|
227
|
+
lengths = [X.shape[0], y.shape[0]]
|
|
228
|
+
uniques = np.unique(lengths)
|
|
229
|
+
if len(uniques) > 1:
|
|
230
|
+
raise ValueError(
|
|
231
|
+
"Found input variables with inconsistent numbers of"
|
|
232
|
+
" samples: %r" % [int(length) for length in lengths]
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
return X, y
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _check_classification_targets(y):
|
|
239
|
+
y_type = _type_of_target(y)
|
|
240
|
+
if y_type not in [
|
|
241
|
+
"binary",
|
|
242
|
+
"multiclass",
|
|
243
|
+
"multiclass-multioutput",
|
|
244
|
+
"multilabel-indicator",
|
|
245
|
+
"multilabel-sequences",
|
|
246
|
+
]:
|
|
247
|
+
raise ValueError("Unknown label type: %r" % y_type)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _type_of_target(y):
|
|
251
|
+
is_sequence, is_array = isinstance(y, Sequence), hasattr(y, "__array__")
|
|
252
|
+
is_not_string, is_sparse = not isinstance(y, str), sp.issparse(y)
|
|
253
|
+
valid = (is_sequence or is_array or is_sparse) and is_not_string
|
|
254
|
+
|
|
255
|
+
if not valid:
|
|
256
|
+
raise ValueError(
|
|
257
|
+
"Expected array-like (array or non-string sequence), " "got %r" % y
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
sparse_pandas = y.__class__.__name__ in ["SparseSeries", "SparseArray"]
|
|
261
|
+
if sparse_pandas:
|
|
262
|
+
raise ValueError("y cannot be class 'SparseSeries' or 'SparseArray'")
|
|
263
|
+
|
|
264
|
+
if _is_multilabel(y):
|
|
265
|
+
return "multilabel-indicator"
|
|
266
|
+
|
|
267
|
+
# DeprecationWarning will be replaced by ValueError, see NEP 34
|
|
268
|
+
# https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
|
|
269
|
+
with warnings.catch_warnings():
|
|
270
|
+
warnings.simplefilter("error", VisibleDeprecationWarning)
|
|
271
|
+
try:
|
|
272
|
+
y = np.asarray(y)
|
|
273
|
+
except VisibleDeprecationWarning:
|
|
274
|
+
# dtype=object should be provided explicitly for ragged arrays,
|
|
275
|
+
# see NEP 34
|
|
276
|
+
y = np.asarray(y, dtype=object)
|
|
277
|
+
|
|
278
|
+
# The old sequence of sequences format
|
|
279
|
+
try:
|
|
280
|
+
if (
|
|
281
|
+
not hasattr(y[0], "__array__")
|
|
282
|
+
and isinstance(y[0], Sequence)
|
|
283
|
+
and not isinstance(y[0], str)
|
|
284
|
+
):
|
|
285
|
+
raise ValueError(
|
|
286
|
+
"You appear to be using a legacy multi-label data"
|
|
287
|
+
" representation. Sequence of sequences are no"
|
|
288
|
+
" longer supported; use a binary array or sparse"
|
|
289
|
+
" matrix instead - the MultiLabelBinarizer"
|
|
290
|
+
" transformer can convert to this format."
|
|
291
|
+
)
|
|
292
|
+
except IndexError:
|
|
293
|
+
pass
|
|
294
|
+
|
|
295
|
+
# Invalid inputs
|
|
296
|
+
if y.ndim > 2 or (y.dtype == object and len(y) and not isinstance(y.flat[0], str)):
|
|
297
|
+
return "unknown" # [[[1, 2]]] or [obj_1] and not ["label_1"]
|
|
298
|
+
|
|
299
|
+
if y.ndim == 2 and y.shape[1] == 0:
|
|
300
|
+
return "unknown" # [[]]
|
|
301
|
+
|
|
302
|
+
if y.ndim == 2 and y.shape[1] > 1:
|
|
303
|
+
suffix = "-multioutput" # [[1, 2], [1, 2]]
|
|
304
|
+
else:
|
|
305
|
+
suffix = "" # [1, 2, 3] or [[1], [2], [3]]
|
|
306
|
+
|
|
307
|
+
# check float and contains non-integer float values
|
|
308
|
+
if y.dtype.kind == "f" and np.any(y != y.astype(int)):
|
|
309
|
+
# [.1, .2, 3] or [[.1, .2, 3]] or [[1., .2]] and not [1., 2., 3.]
|
|
310
|
+
_daal4py_assert_all_finite(y)
|
|
311
|
+
return "continuous" + suffix
|
|
312
|
+
|
|
313
|
+
if (len(np.unique(y)) > 2) or (y.ndim >= 2 and len(y[0]) > 1):
|
|
314
|
+
return "multiclass" + suffix # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]]
|
|
315
|
+
return "binary" # [1, 2] or [["a"], ["b"]]
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def _is_integral_float(y):
|
|
319
|
+
return y.dtype.kind == "f" and np.all(y.astype(int) == y)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def _is_multilabel(y):
|
|
323
|
+
if hasattr(y, "__array__") or isinstance(y, Sequence):
|
|
324
|
+
# DeprecationWarning will be replaced by ValueError, see NEP 34
|
|
325
|
+
# https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
|
|
326
|
+
with warnings.catch_warnings():
|
|
327
|
+
warnings.simplefilter("error", VisibleDeprecationWarning)
|
|
328
|
+
try:
|
|
329
|
+
y = np.asarray(y)
|
|
330
|
+
except VisibleDeprecationWarning:
|
|
331
|
+
# dtype=object should be provided explicitly for ragged arrays,
|
|
332
|
+
# see NEP 34
|
|
333
|
+
y = np.array(y, dtype=object)
|
|
334
|
+
|
|
335
|
+
if not (hasattr(y, "shape") and y.ndim == 2 and y.shape[1] > 1):
|
|
336
|
+
return False
|
|
337
|
+
|
|
338
|
+
if sp.issparse(y):
|
|
339
|
+
if isinstance(y, (sp.dok_matrix, sp.lil_matrix)):
|
|
340
|
+
y = y.tocsr()
|
|
341
|
+
return (
|
|
342
|
+
len(y.data) == 0
|
|
343
|
+
or np.unique(y.data).size == 1
|
|
344
|
+
and (y.dtype.kind in "biu" or _is_integral_float(np.unique(y.data)))
|
|
345
|
+
)
|
|
346
|
+
labels = np.unique(y)
|
|
347
|
+
|
|
348
|
+
return len(labels) < 3 and (y.dtype.kind in "biu" or _is_integral_float(labels))
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def _check_n_features(self, X, reset):
|
|
352
|
+
try:
|
|
353
|
+
n_features = _num_features(X)
|
|
354
|
+
except TypeError as e:
|
|
355
|
+
if not reset and hasattr(self, "n_features_in_"):
|
|
356
|
+
raise ValueError(
|
|
357
|
+
"X does not contain any features, but "
|
|
358
|
+
f"{self.__class__.__name__} is expecting "
|
|
359
|
+
f"{self.n_features_in_} features"
|
|
360
|
+
) from e
|
|
361
|
+
# If the number of features is not defined and reset=True,
|
|
362
|
+
# then we skip this check
|
|
363
|
+
return
|
|
364
|
+
|
|
365
|
+
if reset:
|
|
366
|
+
self.n_features_in_ = n_features
|
|
367
|
+
return
|
|
368
|
+
|
|
369
|
+
if not hasattr(self, "n_features_in_"):
|
|
370
|
+
# Skip this check if the expected number of expected input features
|
|
371
|
+
# was not recorded by calling fit first. This is typically the case
|
|
372
|
+
# for stateless transformers.
|
|
373
|
+
return
|
|
374
|
+
|
|
375
|
+
if n_features != self.n_features_in_:
|
|
376
|
+
raise ValueError(
|
|
377
|
+
f"X has {n_features} features, but {self.__class__.__name__} "
|
|
378
|
+
f"is expecting {self.n_features_in_} features as input."
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def _num_features(X, fallback_1d=False):
|
|
383
|
+
if X is None:
|
|
384
|
+
raise ValueError("Expected array-like (array or non-string sequence), got None")
|
|
385
|
+
type_ = type(X)
|
|
386
|
+
if type_.__module__ == "builtins":
|
|
387
|
+
type_name = type_.__qualname__
|
|
388
|
+
else:
|
|
389
|
+
type_name = f"{type_.__module__}.{type_.__qualname__}"
|
|
390
|
+
message = "Unable to find the number of features from X of type " f"{type_name}"
|
|
391
|
+
if not hasattr(X, "__len__") and not hasattr(X, "shape"):
|
|
392
|
+
if not hasattr(X, "__array__"):
|
|
393
|
+
raise ValueError(message)
|
|
394
|
+
# Only convert X to a numpy array if there is no cheaper, heuristic
|
|
395
|
+
# option.
|
|
396
|
+
X = np.asarray(X)
|
|
397
|
+
|
|
398
|
+
if hasattr(X, "shape"):
|
|
399
|
+
ndim_thr = 1 if fallback_1d else 2
|
|
400
|
+
if not hasattr(X.shape, "__len__") or len(X.shape) < ndim_thr:
|
|
401
|
+
message += f" with shape {X.shape}"
|
|
402
|
+
raise ValueError(message)
|
|
403
|
+
if len(X.shape) <= 1:
|
|
404
|
+
return 1
|
|
405
|
+
else:
|
|
406
|
+
return X.shape[-1]
|
|
407
|
+
|
|
408
|
+
try:
|
|
409
|
+
first_sample = X[0]
|
|
410
|
+
except IndexError:
|
|
411
|
+
raise ValueError("Passed empty data.")
|
|
412
|
+
|
|
413
|
+
# Do not consider an array-like of strings or dicts to be a 2D array
|
|
414
|
+
if isinstance(first_sample, (str, bytes, dict)):
|
|
415
|
+
message += f" where the samples are of type " f"{type(first_sample).__qualname__}"
|
|
416
|
+
raise ValueError(message)
|
|
417
|
+
|
|
418
|
+
try:
|
|
419
|
+
# If X is a list of lists, for instance, we assume that all nested
|
|
420
|
+
# lists have the same length without checking or converting to
|
|
421
|
+
# a numpy array to keep this function call as cheap as possible.
|
|
422
|
+
if (not fallback_1d) or hasattr(first_sample, "__len__"):
|
|
423
|
+
return len(first_sample)
|
|
424
|
+
else:
|
|
425
|
+
return 1
|
|
426
|
+
except Exception as err:
|
|
427
|
+
raise ValueError(message) from err
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
def _num_samples(x):
|
|
431
|
+
message = "Expected sequence or array-like, got %s" % type(x)
|
|
432
|
+
if hasattr(x, "fit") and callable(x.fit):
|
|
433
|
+
# Don't get num_samples from an ensembles length!
|
|
434
|
+
raise TypeError(message)
|
|
435
|
+
|
|
436
|
+
if not hasattr(x, "__len__") and not hasattr(x, "shape"):
|
|
437
|
+
if hasattr(x, "__array__"):
|
|
438
|
+
x = np.asarray(x)
|
|
439
|
+
else:
|
|
440
|
+
raise TypeError(message)
|
|
441
|
+
|
|
442
|
+
if hasattr(x, "shape") and x.shape is not None:
|
|
443
|
+
if len(x.shape) == 0:
|
|
444
|
+
raise TypeError(
|
|
445
|
+
"Singleton array %r cannot be considered a valid collection." % x
|
|
446
|
+
)
|
|
447
|
+
# Check that shape is returning an integer or default to len
|
|
448
|
+
# Dask dataframes may not return numeric shape[0] value
|
|
449
|
+
if hasattr(x, "shape") and isinstance(x.shape[0], Integral):
|
|
450
|
+
return x.shape[0]
|
|
451
|
+
|
|
452
|
+
try:
|
|
453
|
+
return len(x)
|
|
454
|
+
except TypeError as type_error:
|
|
455
|
+
raise TypeError(message) from type_error
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def _is_csr(x):
|
|
459
|
+
"""Return True if x is scipy.sparse.csr_matrix or scipy.sparse.csr_array"""
|
|
460
|
+
return isinstance(x, sp.csr_matrix) or (
|
|
461
|
+
hasattr(sp, "csr_array") and isinstance(x, sp.csr_array)
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def _assert_all_finite(X, allow_nan=False, input_name=""):
|
|
466
|
+
backend_method = BackendFunction(
|
|
467
|
+
backend.finiteness_checker.compute.compute, backend, "compute", no_policy=False
|
|
468
|
+
)
|
|
469
|
+
X_t = to_table(X)
|
|
470
|
+
params = {
|
|
471
|
+
"fptype": X_t.dtype,
|
|
472
|
+
"method": "dense",
|
|
473
|
+
"allow_nan": allow_nan,
|
|
474
|
+
}
|
|
475
|
+
with QM.manage_global_queue(None, X):
|
|
476
|
+
# Must use the queue provided by X
|
|
477
|
+
if not backend_method(params, X_t).finite:
|
|
478
|
+
type_err = "infinity" if allow_nan else "NaN, infinity"
|
|
479
|
+
padded_input_name = input_name + " " if input_name else ""
|
|
480
|
+
msg_err = f"Input {padded_input_name}contains {type_err}."
|
|
481
|
+
raise ValueError(msg_err)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def assert_all_finite(
|
|
485
|
+
X,
|
|
486
|
+
*,
|
|
487
|
+
allow_nan=False,
|
|
488
|
+
input_name="",
|
|
489
|
+
):
|
|
490
|
+
_assert_all_finite(
|
|
491
|
+
X.data if sp.issparse(X) else X,
|
|
492
|
+
allow_nan=allow_nan,
|
|
493
|
+
input_name=input_name,
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def is_contiguous(X):
|
|
498
|
+
if hasattr(X, "flags"):
|
|
499
|
+
return X.flags["C_CONTIGUOUS"] or X.flags["F_CONTIGUOUS"]
|
|
500
|
+
elif hasattr(X, "__dlpack__"):
|
|
501
|
+
return backend.dlpack_memory_order(X) is not None
|
|
502
|
+
else:
|
|
503
|
+
return False
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2021 Intel Corporation
|
|
3
|
+
# Copyright 2024 Fujitsu Limited
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
# ==============================================================================
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from . import utils
|
|
21
|
+
from ._config import config_context, get_config, set_config
|
|
22
|
+
from .dispatcher import (
|
|
23
|
+
get_patch_map,
|
|
24
|
+
get_patch_names,
|
|
25
|
+
is_patched_instance,
|
|
26
|
+
patch_sklearn,
|
|
27
|
+
sklearn_is_patched,
|
|
28
|
+
unpatch_sklearn,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"basic_statistics",
|
|
33
|
+
"cluster",
|
|
34
|
+
"config_context",
|
|
35
|
+
"covariance",
|
|
36
|
+
"decomposition",
|
|
37
|
+
"dummy",
|
|
38
|
+
"ensemble",
|
|
39
|
+
"get_config",
|
|
40
|
+
"get_hyperparameters",
|
|
41
|
+
"get_patch_map",
|
|
42
|
+
"get_patch_names",
|
|
43
|
+
"is_patched_instance",
|
|
44
|
+
"linear_model",
|
|
45
|
+
"manifold",
|
|
46
|
+
"metrics",
|
|
47
|
+
"model_selection",
|
|
48
|
+
"neighbors",
|
|
49
|
+
"patch_sklearn",
|
|
50
|
+
"reset_hyperparameters",
|
|
51
|
+
"set_config",
|
|
52
|
+
"sklearn_is_patched",
|
|
53
|
+
"svm",
|
|
54
|
+
"unpatch_sklearn",
|
|
55
|
+
"utils",
|
|
56
|
+
]
|
|
57
|
+
__version__ = "2199.9.9"
|
|
58
|
+
onedal_iface_flag = os.environ.get("OFF_ONEDAL_IFACE", "0")
|
|
59
|
+
if onedal_iface_flag == "0":
|
|
60
|
+
from onedal import _spmd_backend
|
|
61
|
+
from onedal.common.hyperparameters import get_hyperparameters, reset_hyperparameters
|
|
62
|
+
|
|
63
|
+
if _spmd_backend is not None:
|
|
64
|
+
__all__.append("spmd")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
from ._utils import set_sklearn_ex_verbose
|
|
68
|
+
|
|
69
|
+
set_sklearn_ex_verbose()
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
|
|
19
|
+
from sklearnex import patch_sklearn
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _main():
|
|
23
|
+
import argparse
|
|
24
|
+
|
|
25
|
+
parser = argparse.ArgumentParser(
|
|
26
|
+
prog="python -m sklearnex",
|
|
27
|
+
description="""
|
|
28
|
+
Run your Python script with Extension for
|
|
29
|
+
scikit-learn, optimizing solvers of
|
|
30
|
+
scikit-learn with oneAPI Data Analytics Library.
|
|
31
|
+
""",
|
|
32
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"-m", action="store_true", dest="module", help="Executes following as a module"
|
|
37
|
+
)
|
|
38
|
+
parser.add_argument("name", help="Script or module name")
|
|
39
|
+
parser.add_argument("args", nargs=argparse.REMAINDER, help="Command line arguments")
|
|
40
|
+
args = parser.parse_args()
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
import sklearn
|
|
44
|
+
|
|
45
|
+
patch_sklearn()
|
|
46
|
+
except ImportError:
|
|
47
|
+
print("Scikit-learn could not be imported. Nothing to patch")
|
|
48
|
+
|
|
49
|
+
sys.argv = [args.name] + args.args
|
|
50
|
+
if "_" + args.name in globals():
|
|
51
|
+
return globals()["_" + args.name](*args.args)
|
|
52
|
+
import runpy
|
|
53
|
+
|
|
54
|
+
runf = runpy.run_module if args.module else runpy.run_path
|
|
55
|
+
runf(args.name, run_name="__main__")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
sys.exit(_main())
|