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,420 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2024 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 platform
|
|
18
|
+
import subprocess
|
|
19
|
+
from functools import partial
|
|
20
|
+
from inspect import Parameter, getattr_static, isclass, signature
|
|
21
|
+
|
|
22
|
+
import numpy as np
|
|
23
|
+
from scipy import sparse as sp
|
|
24
|
+
from sklearn import clone
|
|
25
|
+
from sklearn.base import (
|
|
26
|
+
BaseEstimator,
|
|
27
|
+
ClassifierMixin,
|
|
28
|
+
ClusterMixin,
|
|
29
|
+
OutlierMixin,
|
|
30
|
+
RegressorMixin,
|
|
31
|
+
TransformerMixin,
|
|
32
|
+
)
|
|
33
|
+
from sklearn.datasets import load_diabetes, load_iris
|
|
34
|
+
from sklearn.neighbors._base import KNeighborsMixin
|
|
35
|
+
from sklearn.utils.validation import check_is_fitted
|
|
36
|
+
|
|
37
|
+
from onedal.datatypes import from_table, to_table
|
|
38
|
+
from onedal.tests.utils._dataframes_support import _convert_to_dataframe
|
|
39
|
+
from onedal.utils._array_api import _get_sycl_namespace
|
|
40
|
+
from sklearnex import get_patch_map, patch_sklearn, sklearn_is_patched, unpatch_sklearn
|
|
41
|
+
from sklearnex.basic_statistics import BasicStatistics, IncrementalBasicStatistics
|
|
42
|
+
from sklearnex.dummy import DummyRegressor
|
|
43
|
+
from sklearnex.linear_model import LogisticRegression
|
|
44
|
+
from sklearnex.neighbors import (
|
|
45
|
+
KNeighborsClassifier,
|
|
46
|
+
KNeighborsRegressor,
|
|
47
|
+
LocalOutlierFactor,
|
|
48
|
+
NearestNeighbors,
|
|
49
|
+
)
|
|
50
|
+
from sklearnex.svm import SVC, NuSVC
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _load_all_models(with_sklearnex=True, estimator=True):
|
|
54
|
+
"""Convert sklearnex patch_map into a dictionary of estimators or functions
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
with_sklearnex: bool (default=True)
|
|
59
|
+
Discover estimators and methods with sklearnex patching enabled (True)
|
|
60
|
+
or disabled (False) from the sklearnex patch_map
|
|
61
|
+
|
|
62
|
+
estimator: bool (default=True)
|
|
63
|
+
yield estimators (True) or functions (False)
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
dict: {name:estimator}
|
|
68
|
+
estimator is a class or function from sklearn or sklearnex
|
|
69
|
+
"""
|
|
70
|
+
# insure that patch state is correct as dictated by patch_sklearn boolean
|
|
71
|
+
# and return it to the previous state no matter what occurs.
|
|
72
|
+
already_patched_map = sklearn_is_patched(return_map=True)
|
|
73
|
+
already_patched = any(already_patched_map.values())
|
|
74
|
+
try:
|
|
75
|
+
if with_sklearnex:
|
|
76
|
+
patch_sklearn()
|
|
77
|
+
elif already_patched:
|
|
78
|
+
unpatch_sklearn()
|
|
79
|
+
|
|
80
|
+
models = {}
|
|
81
|
+
for patch_infos in get_patch_map().values():
|
|
82
|
+
candidate = getattr(patch_infos[0][0][0], patch_infos[0][0][1], None)
|
|
83
|
+
if candidate is not None and isclass(candidate) == estimator:
|
|
84
|
+
if not estimator or issubclass(candidate, BaseEstimator):
|
|
85
|
+
models[patch_infos[0][0][1]] = candidate
|
|
86
|
+
finally:
|
|
87
|
+
if with_sklearnex:
|
|
88
|
+
unpatch_sklearn()
|
|
89
|
+
# both branches are now in an unpatched state, repatch as necessary
|
|
90
|
+
if already_patched:
|
|
91
|
+
patch_sklearn(name=[i for i in already_patched_map if already_patched_map[i]])
|
|
92
|
+
|
|
93
|
+
return models
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
PATCHED_MODELS = _load_all_models(with_sklearnex=True)
|
|
97
|
+
UNPATCHED_MODELS = _load_all_models(with_sklearnex=False)
|
|
98
|
+
|
|
99
|
+
PATCHED_FUNCTIONS = _load_all_models(with_sklearnex=True, estimator=False)
|
|
100
|
+
UNPATCHED_FUNCTIONS = _load_all_models(with_sklearnex=False, estimator=False)
|
|
101
|
+
|
|
102
|
+
mixin_map = [
|
|
103
|
+
[
|
|
104
|
+
ClassifierMixin,
|
|
105
|
+
["decision_function", "predict", "predict_proba", "predict_log_proba", "score"],
|
|
106
|
+
"classification",
|
|
107
|
+
],
|
|
108
|
+
[RegressorMixin, ["predict", "score"], "regression"],
|
|
109
|
+
[ClusterMixin, ["fit_predict"], "classification"],
|
|
110
|
+
[TransformerMixin, ["fit_transform", "transform", "score"], "classification"],
|
|
111
|
+
[OutlierMixin, ["fit_predict", "predict"], "classification"],
|
|
112
|
+
[KNeighborsMixin, ["kneighbors"], None],
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class sklearn_clone_dict(dict):
|
|
117
|
+
"""Special dict type for returning state-free sklearn/sklearnex estimators
|
|
118
|
+
with the same parameters"""
|
|
119
|
+
|
|
120
|
+
def __getitem__(self, key):
|
|
121
|
+
return clone(super().__getitem__(key))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# Special dictionary of sklearnex estimators which must be specifically tested, this
|
|
125
|
+
# could be because of supported non-default parameters, blocked support via sklearn's
|
|
126
|
+
# 'available_if' decorator, or not being a native sklearn estimator (i.e. those not in
|
|
127
|
+
# the default PATCHED_MODELS dictionary)
|
|
128
|
+
SPECIAL_INSTANCES = sklearn_clone_dict(
|
|
129
|
+
{
|
|
130
|
+
str(i): i
|
|
131
|
+
for i in [
|
|
132
|
+
LocalOutlierFactor(novelty=True),
|
|
133
|
+
SVC(probability=True),
|
|
134
|
+
NuSVC(probability=True),
|
|
135
|
+
KNeighborsClassifier(algorithm="brute"),
|
|
136
|
+
KNeighborsRegressor(algorithm="brute"),
|
|
137
|
+
NearestNeighbors(algorithm="brute"),
|
|
138
|
+
LogisticRegression(solver="newton-cg"),
|
|
139
|
+
BasicStatistics(),
|
|
140
|
+
IncrementalBasicStatistics(),
|
|
141
|
+
DummyRegressor(strategy="constant", constant=1.0), # val set to 1 arbitrarily
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def gen_models_info(algorithms, required_inputs=["X", "y"], fit=False, daal4py=True):
|
|
148
|
+
"""Generate estimator-attribute pairs for pytest test collection.
|
|
149
|
+
|
|
150
|
+
Parameters
|
|
151
|
+
----------
|
|
152
|
+
algorithms : iterable (list, tuple, 1D array-like object)
|
|
153
|
+
Iterable of valid sklearnex estimators or keys from PATCHED_MODELS
|
|
154
|
+
|
|
155
|
+
required_inputs : list, tuple of strings or None
|
|
156
|
+
list of required args/kwargs for callable attribute (only non-private,
|
|
157
|
+
non-BaseEstimator attributes). Only one must be present, None
|
|
158
|
+
signifies taking all non-private attributes, callable or not.
|
|
159
|
+
|
|
160
|
+
fit: bool (default False)
|
|
161
|
+
Include "fit" method as an estimator-attribute pair
|
|
162
|
+
|
|
163
|
+
daal4py: bool (default True)
|
|
164
|
+
Include daal4py estimators in estimator-attribute list
|
|
165
|
+
|
|
166
|
+
Returns
|
|
167
|
+
-------
|
|
168
|
+
list of 2-element tuples: (estimator, string)
|
|
169
|
+
Returns a list of valid methods or attributes without "fit"
|
|
170
|
+
"""
|
|
171
|
+
output = []
|
|
172
|
+
for estimator in algorithms:
|
|
173
|
+
|
|
174
|
+
if estimator in PATCHED_MODELS:
|
|
175
|
+
est = PATCHED_MODELS[estimator]
|
|
176
|
+
elif estimator in SPECIAL_INSTANCES:
|
|
177
|
+
est = SPECIAL_INSTANCES[estimator].__class__
|
|
178
|
+
elif isinstance(algorithms[estimator], BaseEstimator):
|
|
179
|
+
est = algorithms[estimator].__class__
|
|
180
|
+
else:
|
|
181
|
+
raise KeyError(f"Unrecognized sklearnex estimator: {estimator}")
|
|
182
|
+
|
|
183
|
+
if not daal4py and est.__module__.startswith("daal4py"):
|
|
184
|
+
continue
|
|
185
|
+
|
|
186
|
+
# remove BaseEstimator methods (get_params, set_params)
|
|
187
|
+
candidates = set(dir(est)) - set(dir(BaseEstimator))
|
|
188
|
+
# remove private methods
|
|
189
|
+
candidates = set([attr for attr in candidates if not attr.startswith("_")])
|
|
190
|
+
# required to enable other methods
|
|
191
|
+
if not fit:
|
|
192
|
+
candidates = candidates - {"fit"}
|
|
193
|
+
|
|
194
|
+
# allow only callable methods with any of the required inputs
|
|
195
|
+
if required_inputs:
|
|
196
|
+
methods = []
|
|
197
|
+
for attr in candidates:
|
|
198
|
+
attribute = getattr_static(est, attr)
|
|
199
|
+
if callable(attribute):
|
|
200
|
+
params = signature(attribute).parameters
|
|
201
|
+
if any([inp in params for inp in required_inputs]):
|
|
202
|
+
methods += [attr]
|
|
203
|
+
else:
|
|
204
|
+
methods = candidates
|
|
205
|
+
|
|
206
|
+
output += (
|
|
207
|
+
[(estimator, method) for method in methods]
|
|
208
|
+
if methods
|
|
209
|
+
else [(estimator, None)]
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
# In the case that no methods are available, set method to None.
|
|
213
|
+
# This will allow estimators without mixins to still test the fit
|
|
214
|
+
# method in various tests.
|
|
215
|
+
return output
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def call_method(estimator, method, X, y, **kwargs):
|
|
219
|
+
"""Generalized interface to call most sklearn estimator methods
|
|
220
|
+
|
|
221
|
+
Parameters
|
|
222
|
+
----------
|
|
223
|
+
estimator : sklearn or sklearnex estimator instance
|
|
224
|
+
|
|
225
|
+
method: string
|
|
226
|
+
Valid callable method to estimator
|
|
227
|
+
|
|
228
|
+
X: array-like
|
|
229
|
+
data
|
|
230
|
+
|
|
231
|
+
y: array-like (for 'score', 'partial-fit', and 'path')
|
|
232
|
+
X-dependent data
|
|
233
|
+
|
|
234
|
+
**kwargs: keyword dict
|
|
235
|
+
keyword arguments to estimator.method
|
|
236
|
+
|
|
237
|
+
Returns
|
|
238
|
+
-------
|
|
239
|
+
return value from estimator.method
|
|
240
|
+
"""
|
|
241
|
+
# useful for repository wide testing
|
|
242
|
+
|
|
243
|
+
func = getattr(estimator, method)
|
|
244
|
+
argdict = signature(func).parameters
|
|
245
|
+
argnum = len(
|
|
246
|
+
[i for i in argdict if argdict[i].default == Parameter.empty or i in ["X", "y"]]
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
if method == "inverse_transform":
|
|
250
|
+
# PCA's inverse_transform takes (n_samples, n_components)
|
|
251
|
+
data = (
|
|
252
|
+
(X[:, : estimator.n_components_],)
|
|
253
|
+
if X.shape[1] != estimator.n_components_
|
|
254
|
+
else (X,)
|
|
255
|
+
)
|
|
256
|
+
else:
|
|
257
|
+
data = (X, y)[:argnum]
|
|
258
|
+
|
|
259
|
+
return func(*data, **kwargs)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def _gen_dataset_type(est):
|
|
263
|
+
# est should be an estimator or estimator class
|
|
264
|
+
# dataset initialized to classification, but will be swapped
|
|
265
|
+
# for other types as necessary. Private method.
|
|
266
|
+
dataset = "classification"
|
|
267
|
+
estimator = est.__class__ if isinstance(est, BaseEstimator) else est
|
|
268
|
+
|
|
269
|
+
for mixin, _, data in mixin_map:
|
|
270
|
+
if issubclass(estimator, mixin) and data is not None:
|
|
271
|
+
dataset = data
|
|
272
|
+
return dataset
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
_dataset_dict = {
|
|
276
|
+
"classification": [partial(load_iris, return_X_y=True)],
|
|
277
|
+
"regression": [partial(load_diabetes, return_X_y=True)],
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def gen_dataset(
|
|
282
|
+
est,
|
|
283
|
+
datasets=_dataset_dict,
|
|
284
|
+
sparse=False,
|
|
285
|
+
queue=None,
|
|
286
|
+
target_df=None,
|
|
287
|
+
dtype=None,
|
|
288
|
+
):
|
|
289
|
+
"""Generate dataset for pytest testing.
|
|
290
|
+
|
|
291
|
+
Parameters
|
|
292
|
+
----------
|
|
293
|
+
est : sklearn or sklearnex estimator class
|
|
294
|
+
Must inherit an sklearn Mixin or sklearn's BaseEstimator
|
|
295
|
+
|
|
296
|
+
dataset: dataset dict
|
|
297
|
+
Dictionary with keys "classification" and/or "regression"
|
|
298
|
+
Value must be a list of object which yield X, y array
|
|
299
|
+
objects when called, ideally using a lambda or
|
|
300
|
+
functools.partial.
|
|
301
|
+
|
|
302
|
+
sparse: bool (default False)
|
|
303
|
+
Convert X data to a scipy.sparse csr_matrix format.
|
|
304
|
+
|
|
305
|
+
queue: SYCL queue or None
|
|
306
|
+
Queue necessary for device offloading following the
|
|
307
|
+
SYCL 2020 standard, usually generated by dpctl.
|
|
308
|
+
|
|
309
|
+
target_df: string or None
|
|
310
|
+
dataframe type for returned dataset, as dictated by
|
|
311
|
+
onedal's _convert_to_dataframe.
|
|
312
|
+
|
|
313
|
+
dtype: numpy dtype or None
|
|
314
|
+
target datatype for returned datasets (see DTYPES).
|
|
315
|
+
|
|
316
|
+
Returns
|
|
317
|
+
-------
|
|
318
|
+
list of 2-element list X,y: (array-like, array-like)
|
|
319
|
+
list of datasets for analysis
|
|
320
|
+
"""
|
|
321
|
+
dataset_type = _gen_dataset_type(est)
|
|
322
|
+
output = []
|
|
323
|
+
# load data
|
|
324
|
+
flag = dtype is None
|
|
325
|
+
|
|
326
|
+
for func in datasets[dataset_type]:
|
|
327
|
+
X, y = func()
|
|
328
|
+
if flag:
|
|
329
|
+
dtype = X.dtype if hasattr(X, "dtype") else np.float64
|
|
330
|
+
|
|
331
|
+
if sparse:
|
|
332
|
+
X = sp.csr_matrix(X)
|
|
333
|
+
else:
|
|
334
|
+
X = _convert_to_dataframe(
|
|
335
|
+
X, sycl_queue=queue, target_df=target_df, dtype=dtype
|
|
336
|
+
)
|
|
337
|
+
y = _convert_to_dataframe(
|
|
338
|
+
y, sycl_queue=queue, target_df=target_df, dtype=dtype
|
|
339
|
+
)
|
|
340
|
+
output += [[X, y]]
|
|
341
|
+
return output
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def gen_sparse_dataset(row_count, column_count, **kwargs):
|
|
345
|
+
"""Generate sparse dataset for pytest testing.
|
|
346
|
+
|
|
347
|
+
Parameters
|
|
348
|
+
----------
|
|
349
|
+
row_count : number of rows in dataset
|
|
350
|
+
|
|
351
|
+
column_count: number of columns in dataset
|
|
352
|
+
|
|
353
|
+
kwargs: keyword arguments for scipy.sparse.random_array or scipy.sparse.random
|
|
354
|
+
|
|
355
|
+
Returns
|
|
356
|
+
-------
|
|
357
|
+
scipy.sparse random matrix or array depending on scipy version
|
|
358
|
+
"""
|
|
359
|
+
if hasattr(sp, "random_array"):
|
|
360
|
+
return sp.random_array((row_count, column_count), **kwargs)
|
|
361
|
+
else:
|
|
362
|
+
return sp.random(row_count, column_count, **kwargs)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
DTYPES = [
|
|
366
|
+
np.int8,
|
|
367
|
+
np.int16,
|
|
368
|
+
np.int32,
|
|
369
|
+
np.int64,
|
|
370
|
+
np.float16,
|
|
371
|
+
np.float32,
|
|
372
|
+
np.float64,
|
|
373
|
+
np.uint8,
|
|
374
|
+
np.uint16,
|
|
375
|
+
np.uint32,
|
|
376
|
+
np.uint64,
|
|
377
|
+
]
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def _get_processor_info():
|
|
381
|
+
proc = ""
|
|
382
|
+
if platform.system() == "Linux":
|
|
383
|
+
proc = (
|
|
384
|
+
subprocess.check_output(["/usr/bin/cat", "/proc/cpuinfo"])
|
|
385
|
+
.strip()
|
|
386
|
+
.decode("utf-8")
|
|
387
|
+
)
|
|
388
|
+
elif platform.system() == "Windows":
|
|
389
|
+
proc = platform.processor()
|
|
390
|
+
elif platform.system() == "Darwin":
|
|
391
|
+
proc = (
|
|
392
|
+
subprocess.check_output(["/usr/bin/sysctl", "-n", "machdep.cpu.brand_string"])
|
|
393
|
+
.strip()
|
|
394
|
+
.decode("utf-8")
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
return proc
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
class DummyEstimator(BaseEstimator):
|
|
401
|
+
|
|
402
|
+
def fit(self, X, y=None):
|
|
403
|
+
X_table = to_table(X)
|
|
404
|
+
y_table = to_table(y)
|
|
405
|
+
# The presence of the fitted attributes (ending with a trailing
|
|
406
|
+
# underscore) is required for the correct check. The cleanup of
|
|
407
|
+
# the memory will occur at the estimator instance deletion.
|
|
408
|
+
self.x_attr_ = from_table(X_table, like=X)
|
|
409
|
+
self.y_attr_ = from_table(y_table, like=X if y is None else y)
|
|
410
|
+
|
|
411
|
+
return self
|
|
412
|
+
|
|
413
|
+
def predict(self, X):
|
|
414
|
+
# Checks if the estimator is fitted by verifying the presence of
|
|
415
|
+
# fitted attributes (ending with a trailing underscore).
|
|
416
|
+
check_is_fitted(self)
|
|
417
|
+
X_table = to_table(X)
|
|
418
|
+
returned_X = from_table(X_table, like=X)
|
|
419
|
+
|
|
420
|
+
return returned_X
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2024 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 numpy as np
|
|
18
|
+
from numpy.testing import assert_allclose
|
|
19
|
+
from sklearn.datasets import make_blobs, make_classification, make_regression
|
|
20
|
+
from sklearn.model_selection import train_test_split
|
|
21
|
+
|
|
22
|
+
from onedal.tests.utils._dataframes_support import _as_numpy
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
import dpctl
|
|
26
|
+
from dpctl import SyclQueue
|
|
27
|
+
from mpi4py import MPI
|
|
28
|
+
|
|
29
|
+
mpi_libs_available = True
|
|
30
|
+
gpu_is_available = dpctl.has_gpu_devices()
|
|
31
|
+
except (ImportError, ModuleNotFoundError):
|
|
32
|
+
mpi_libs_available = False
|
|
33
|
+
|
|
34
|
+
_mpi_libs_and_gpu_available = mpi_libs_available and gpu_is_available
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _get_local_tensor(full_data):
|
|
38
|
+
"""Splits data across ranks.
|
|
39
|
+
|
|
40
|
+
Called on each rank to extract the subset of data assigned to that rank.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
full_data (numpy or dpctl array): The entire set of data
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
local_data (numpy or dpctl array): The subset of data used by the rank
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
# create sycl queue and gather communicator details
|
|
50
|
+
q = SyclQueue("gpu")
|
|
51
|
+
comm = MPI.COMM_WORLD
|
|
52
|
+
rank = comm.Get_rank()
|
|
53
|
+
size = comm.Get_size()
|
|
54
|
+
|
|
55
|
+
# divide data across ranks and move to dpt tensor
|
|
56
|
+
data_rows = full_data.shape[0]
|
|
57
|
+
local_start = rank * data_rows // size
|
|
58
|
+
local_end = (1 + rank) * data_rows // size
|
|
59
|
+
local_data = full_data[local_start:local_end]
|
|
60
|
+
|
|
61
|
+
return local_data
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _generate_regression_data(n_samples, n_features, dtype=np.float64, random_state=42):
|
|
65
|
+
# Generates regression data and divides between train and test
|
|
66
|
+
X, y = make_regression(
|
|
67
|
+
n_samples=n_samples, n_features=n_features, random_state=random_state
|
|
68
|
+
)
|
|
69
|
+
X = X.astype(dtype)
|
|
70
|
+
y = y.astype(dtype)
|
|
71
|
+
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=random_state)
|
|
72
|
+
return X_train, X_test, y_train, y_test
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _generate_classification_data(
|
|
76
|
+
n_samples, n_features, n_classes=2, dtype=np.float64, random_state=42
|
|
77
|
+
):
|
|
78
|
+
# Generates classification data and divides between train and test
|
|
79
|
+
X, y = make_classification(
|
|
80
|
+
n_samples=n_samples,
|
|
81
|
+
n_features=n_features,
|
|
82
|
+
n_classes=n_classes,
|
|
83
|
+
n_informative=int(0.5 * n_classes + 1),
|
|
84
|
+
random_state=random_state,
|
|
85
|
+
)
|
|
86
|
+
X = X.astype(dtype)
|
|
87
|
+
y = y.astype(dtype)
|
|
88
|
+
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=random_state)
|
|
89
|
+
return X_train, X_test, y_train, y_test
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _generate_statistic_data(
|
|
93
|
+
n_samples, n_features=None, dtype=np.float64, random_state=42
|
|
94
|
+
):
|
|
95
|
+
# Generates statistical data
|
|
96
|
+
gen = np.random.default_rng(random_state)
|
|
97
|
+
data = gen.uniform(
|
|
98
|
+
low=-0.3,
|
|
99
|
+
high=+0.7,
|
|
100
|
+
size=(n_samples, n_features) if n_features is not None else (n_samples,),
|
|
101
|
+
).astype(dtype)
|
|
102
|
+
return data
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _generate_clustering_data(
|
|
106
|
+
n_samples, n_features, centers=None, dtype=np.float64, random_state=42
|
|
107
|
+
):
|
|
108
|
+
# Generates clustering data and divides between train and test
|
|
109
|
+
X, _ = make_blobs(
|
|
110
|
+
n_samples=n_samples,
|
|
111
|
+
centers=centers,
|
|
112
|
+
n_features=n_features,
|
|
113
|
+
random_state=random_state,
|
|
114
|
+
)
|
|
115
|
+
X = X.astype(dtype)
|
|
116
|
+
X_train, X_test = train_test_split(X, random_state=random_state)
|
|
117
|
+
return X_train, X_test
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _spmd_assert_allclose(spmd_result, batch_result, **kwargs):
|
|
121
|
+
"""Calls assert_allclose on spmd and batch results.
|
|
122
|
+
|
|
123
|
+
Called on each rank to compare the spmd result specific to that rank and
|
|
124
|
+
subset of batch result that corresponds to that rank.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
spmd_result (numpy or dpctl array): The result for the subset of data on the rank the function is called from, computed by the spmd estimator
|
|
128
|
+
batch_result (numpy array): The result for all data, computed by the batch estimator
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
AssertionError: If all results are not adequately close.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
# extract chunk from batch result to match with local spmd result
|
|
135
|
+
local_batch_result = _get_local_tensor(batch_result)
|
|
136
|
+
|
|
137
|
+
assert_allclose(_as_numpy(spmd_result), _as_numpy(local_batch_result), **kwargs)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _assert_unordered_allclose(spmd_result, batch_result, localize=False, **kwargs):
|
|
141
|
+
"""Checks if rows in spmd and batch results are aligned, even if not in the same order.
|
|
142
|
+
|
|
143
|
+
Called to verify correct unordered results are present. Useful to check KMeans centers
|
|
144
|
+
or KNN neighbors, where order does not matter. Sorts inputs to handle unordering. Also
|
|
145
|
+
capable of handling localization.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
spmd_result (numpy or dpctl array): Result computed by the spmd estimator
|
|
149
|
+
batch_result (numpy array): Result computed by batch estimator
|
|
150
|
+
localize (bool): Whether of not spmd result is specific to the rank, in which case batch result needs to be localized
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
AssertionError: If results do not match.
|
|
154
|
+
"""
|
|
155
|
+
np_spmd_result = _as_numpy(spmd_result)
|
|
156
|
+
|
|
157
|
+
sorted_spmd_result = np_spmd_result[
|
|
158
|
+
np.argsort(np.linalg.norm(np_spmd_result, axis=1))
|
|
159
|
+
]
|
|
160
|
+
if localize:
|
|
161
|
+
local_batch_result = _get_local_tensor(batch_result)
|
|
162
|
+
sorted_batch_result = local_batch_result[
|
|
163
|
+
np.argsort(np.linalg.norm(local_batch_result, axis=1))
|
|
164
|
+
]
|
|
165
|
+
else:
|
|
166
|
+
sorted_batch_result = batch_result[
|
|
167
|
+
np.argsort(np.linalg.norm(batch_result, axis=1))
|
|
168
|
+
]
|
|
169
|
+
|
|
170
|
+
assert_allclose(sorted_spmd_result, sorted_batch_result, **kwargs)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _assert_kmeans_labels_allclose(
|
|
174
|
+
spmd_labels, batch_labels, spmd_centers, batch_centers, **kwargs
|
|
175
|
+
):
|
|
176
|
+
"""Checks if labels for spmd and batch results are aligned, even cluster indices don't match.
|
|
177
|
+
|
|
178
|
+
Called to verify labels are assigned the same way on spmd and batch. Uses raw labels (which
|
|
179
|
+
may not match) to identify cluster center and ensure results match.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
spmd_labels (numpy or dpctl array): The labels for the subset of data on the rank the function is called from, computed by the spmd estimator
|
|
183
|
+
batch_labels (numpy array): The labels for all data, computed by the batch estimator
|
|
184
|
+
spmd_centers (numpy or dpctl array): Centers computed by the spmd estimator
|
|
185
|
+
batch_centers (numpy array): Centers computed by batch estimator
|
|
186
|
+
|
|
187
|
+
Raises:
|
|
188
|
+
AssertionError: If clusters are not correctly assigned.
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
np_spmd_labels = _as_numpy(spmd_labels)
|
|
192
|
+
np_spmd_centers = _as_numpy(spmd_centers)
|
|
193
|
+
local_batch_labels = _get_local_tensor(batch_labels)
|
|
194
|
+
assert_allclose(
|
|
195
|
+
np_spmd_centers[np_spmd_labels],
|
|
196
|
+
batch_centers[local_batch_labels],
|
|
197
|
+
**kwargs,
|
|
198
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ===============================================================================
|
|
2
|
+
# Copyright 2022 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ===============================================================================
|
|
16
|
+
|
|
17
|
+
from .validation import assert_all_finite
|
|
18
|
+
|
|
19
|
+
__all__ = ["assert_all_finite"]
|