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
scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2023 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 logging
|
|
19
|
+
from multiprocessing import cpu_count
|
|
20
|
+
|
|
21
|
+
import pytest
|
|
22
|
+
from sklearn.datasets import make_classification
|
|
23
|
+
from sklearn.exceptions import NotFittedError
|
|
24
|
+
|
|
25
|
+
from sklearnex.tests.utils import (
|
|
26
|
+
PATCHED_MODELS,
|
|
27
|
+
SPECIAL_INSTANCES,
|
|
28
|
+
call_method,
|
|
29
|
+
gen_dataset,
|
|
30
|
+
gen_models_info,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
_X, _Y = make_classification(n_samples=40, n_features=4, random_state=42)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _get_estimator_instance(estimator):
|
|
37
|
+
if estimator in PATCHED_MODELS:
|
|
38
|
+
est = PATCHED_MODELS[estimator]()
|
|
39
|
+
elif estimator in SPECIAL_INSTANCES:
|
|
40
|
+
est = SPECIAL_INSTANCES[estimator]
|
|
41
|
+
else:
|
|
42
|
+
raise KeyError(f"{estimator} not in patch_map or SPECIAL_INSTANCES")
|
|
43
|
+
return est
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _check_n_jobs_entry_in_logs(records, function_name, n_jobs):
|
|
47
|
+
expected_n_jobs = max(n_jobs, n_jobs % (cpu_count() + 1)) if n_jobs else cpu_count()
|
|
48
|
+
for rec in records:
|
|
49
|
+
if f"{function_name}: setting {expected_n_jobs} threads" in rec:
|
|
50
|
+
return True
|
|
51
|
+
# False if n_jobs is set and not found in logs
|
|
52
|
+
return n_jobs is None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.mark.parametrize("estimator", {**PATCHED_MODELS, **SPECIAL_INSTANCES}.keys())
|
|
56
|
+
def test_n_jobs_documentation(estimator):
|
|
57
|
+
est = _get_estimator_instance(estimator)
|
|
58
|
+
assert "n_jobs" in est.__doc__
|
|
59
|
+
assert "n_jobs" in est.__class__.__doc__
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@pytest.mark.parametrize("estimator", {**PATCHED_MODELS, **SPECIAL_INSTANCES}.keys())
|
|
63
|
+
def test_n_jobs_method_decoration(estimator):
|
|
64
|
+
est = _get_estimator_instance(estimator)
|
|
65
|
+
for func_name, func in vars(est).items():
|
|
66
|
+
# hasattr check necessary due to sklearn's available_if wrapper
|
|
67
|
+
if hasattr(est, func_name) and callable(func):
|
|
68
|
+
assert hasattr(func, "__onedal_n_jobs_decorated__") == (
|
|
69
|
+
func_name in est._n_jobs_supported_onedal_methods
|
|
70
|
+
), f"{est}.{func_name} n_jobs decoration does not match {est} n_jobs supported methods"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@pytest.mark.parametrize("estimator", {**PATCHED_MODELS, **SPECIAL_INSTANCES}.keys())
|
|
74
|
+
@pytest.mark.parametrize("n_jobs", [None, -1, 1, 2])
|
|
75
|
+
def test_n_jobs_support(estimator, n_jobs, caplog):
|
|
76
|
+
|
|
77
|
+
if estimator == "DummyRegressor":
|
|
78
|
+
pytest.skip("default parameters fall back to sklearn")
|
|
79
|
+
|
|
80
|
+
est = _get_estimator_instance(estimator)
|
|
81
|
+
caplog.set_level(logging.DEBUG, logger="sklearnex")
|
|
82
|
+
|
|
83
|
+
# copy params and modify n_jobs, assumes estimator inherits from BaseEstimator
|
|
84
|
+
# or properly supports get_params and set_params methods as defined by sklearn
|
|
85
|
+
params = est.get_params()
|
|
86
|
+
params["n_jobs"] = n_jobs
|
|
87
|
+
est.set_params(**params)
|
|
88
|
+
|
|
89
|
+
# check `n_jobs` log entry for supported methods
|
|
90
|
+
# `fit` call is required before other methods
|
|
91
|
+
est.fit(_X, _Y)
|
|
92
|
+
messages = [msg.message for msg in caplog.records]
|
|
93
|
+
assert _check_n_jobs_entry_in_logs(messages, "fit", n_jobs)
|
|
94
|
+
|
|
95
|
+
for method_name in est._n_jobs_supported_onedal_methods:
|
|
96
|
+
# do not call fit again, handle sklearn's available_if wrapper
|
|
97
|
+
if method_name == "fit" or (
|
|
98
|
+
"NearestNeighbors" in estimator and "radius" in method_name
|
|
99
|
+
):
|
|
100
|
+
# radius_neighbors and radius_neighbors_graph violate sklearn fallback guard
|
|
101
|
+
# but use sklearnex internally, additional development must be done to those
|
|
102
|
+
# functions to bring them to design compliance.
|
|
103
|
+
continue
|
|
104
|
+
try:
|
|
105
|
+
call_method(est, method_name, _X, _Y)
|
|
106
|
+
except (NotFittedError, AttributeError) as e:
|
|
107
|
+
# handle sklearns available_if wrapper
|
|
108
|
+
continue
|
|
109
|
+
|
|
110
|
+
messages = [msg.message for msg in caplog.records]
|
|
111
|
+
assert _check_n_jobs_entry_in_logs(messages, method_name, n_jobs)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2023 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
|
+
import pytest
|
|
17
|
+
|
|
18
|
+
from sklearnex import config_context
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
import dpctl
|
|
22
|
+
|
|
23
|
+
dpctl_is_available = True
|
|
24
|
+
gpu_is_available = dpctl.has_gpu_devices()
|
|
25
|
+
except (ImportError, ModuleNotFoundError):
|
|
26
|
+
dpctl_is_available = False
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@pytest.mark.skipif(
|
|
30
|
+
not dpctl_is_available or gpu_is_available,
|
|
31
|
+
reason="GPU device should not be available for this test "
|
|
32
|
+
"to see raised 'SyclQueueCreationError'. "
|
|
33
|
+
"'dpctl' module is required for test.",
|
|
34
|
+
)
|
|
35
|
+
def test_config_context_in_parallel(with_sklearnex):
|
|
36
|
+
from sklearn.datasets import make_classification
|
|
37
|
+
from sklearn.ensemble import BaggingClassifier
|
|
38
|
+
from sklearn.svm import SVC
|
|
39
|
+
|
|
40
|
+
x, y = make_classification(random_state=42)
|
|
41
|
+
try:
|
|
42
|
+
with config_context(target_offload="gpu", allow_fallback_to_host=False):
|
|
43
|
+
BaggingClassifier(SVC(), n_jobs=2).fit(x, y)
|
|
44
|
+
raise ValueError(
|
|
45
|
+
"'SyclQueueCreationError' wasn't raised " "for non-existing 'gpu' device"
|
|
46
|
+
)
|
|
47
|
+
except dpctl._sycl_queue.SyclQueueCreationError:
|
|
48
|
+
pass
|
|
@@ -0,0 +1,418 @@
|
|
|
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
|
+
|
|
18
|
+
import importlib
|
|
19
|
+
import logging
|
|
20
|
+
import os
|
|
21
|
+
import re
|
|
22
|
+
import sys
|
|
23
|
+
from inspect import signature
|
|
24
|
+
|
|
25
|
+
import numpy as np
|
|
26
|
+
import numpy.random as nprnd
|
|
27
|
+
import pytest
|
|
28
|
+
from sklearn.base import BaseEstimator
|
|
29
|
+
|
|
30
|
+
from daal4py.sklearn._utils import _package_check_version, sklearn_check_version
|
|
31
|
+
from onedal.tests.utils._dataframes_support import (
|
|
32
|
+
_convert_to_dataframe,
|
|
33
|
+
get_dataframes_and_queues,
|
|
34
|
+
)
|
|
35
|
+
from sklearnex import config_context, is_patched_instance
|
|
36
|
+
from sklearnex._utils import get_tags
|
|
37
|
+
from sklearnex.dispatcher import _is_preview_enabled
|
|
38
|
+
from sklearnex.metrics import pairwise_distances, roc_auc_score
|
|
39
|
+
from sklearnex.tests.utils import (
|
|
40
|
+
DTYPES,
|
|
41
|
+
PATCHED_FUNCTIONS,
|
|
42
|
+
PATCHED_MODELS,
|
|
43
|
+
SPECIAL_INSTANCES,
|
|
44
|
+
UNPATCHED_FUNCTIONS,
|
|
45
|
+
UNPATCHED_MODELS,
|
|
46
|
+
call_method,
|
|
47
|
+
gen_dataset,
|
|
48
|
+
gen_models_info,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@pytest.mark.parametrize("dtype", DTYPES)
|
|
53
|
+
@pytest.mark.parametrize("dataframe, queue", get_dataframes_and_queues())
|
|
54
|
+
@pytest.mark.parametrize("metric", ["cosine", "correlation"])
|
|
55
|
+
def test_pairwise_distances_patching(caplog, dataframe, queue, dtype, metric):
|
|
56
|
+
with caplog.at_level(logging.WARNING, logger="sklearnex"):
|
|
57
|
+
if dtype == np.float16 and queue and not queue.sycl_device.has_aspect_fp16:
|
|
58
|
+
pytest.skip("Hardware does not support fp16 SYCL testing")
|
|
59
|
+
elif dtype == np.float64 and queue and not queue.sycl_device.has_aspect_fp64:
|
|
60
|
+
pytest.skip("Hardware does not support fp64 SYCL testing")
|
|
61
|
+
elif queue and queue.sycl_device.is_gpu:
|
|
62
|
+
pytest.skip("pairwise_distances does not support GPU queues")
|
|
63
|
+
|
|
64
|
+
rng = nprnd.default_rng()
|
|
65
|
+
if dataframe == "pandas":
|
|
66
|
+
X = _convert_to_dataframe(
|
|
67
|
+
rng.random(size=1000).astype(dtype).reshape(1, -1),
|
|
68
|
+
target_df=dataframe,
|
|
69
|
+
)
|
|
70
|
+
else:
|
|
71
|
+
X = _convert_to_dataframe(
|
|
72
|
+
rng.random(size=1000), sycl_queue=queue, target_df=dataframe, dtype=dtype
|
|
73
|
+
)[None, :]
|
|
74
|
+
|
|
75
|
+
_ = pairwise_distances(X, metric=metric)
|
|
76
|
+
assert all(
|
|
77
|
+
[
|
|
78
|
+
"running accelerated version" in i.message
|
|
79
|
+
or "fallback to original Scikit-learn" in i.message
|
|
80
|
+
for i in caplog.records
|
|
81
|
+
]
|
|
82
|
+
), f"sklearnex patching issue in pairwise_distances with log: \n{caplog.text}"
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@pytest.mark.parametrize(
|
|
86
|
+
"dtype", [i for i in DTYPES if "32" in i.__name__ or "64" in i.__name__]
|
|
87
|
+
)
|
|
88
|
+
@pytest.mark.parametrize("dataframe, queue", get_dataframes_and_queues())
|
|
89
|
+
def test_roc_auc_score_patching(caplog, dataframe, queue, dtype):
|
|
90
|
+
if dtype in [np.uint32, np.uint64] and sys.platform == "win32":
|
|
91
|
+
pytest.skip("Windows issue with unsigned ints")
|
|
92
|
+
elif dtype == np.float64 and queue and not queue.sycl_device.has_aspect_fp64:
|
|
93
|
+
pytest.skip("Hardware does not support fp64 SYCL testing")
|
|
94
|
+
|
|
95
|
+
with caplog.at_level(logging.WARNING, logger="sklearnex"):
|
|
96
|
+
rng = nprnd.default_rng()
|
|
97
|
+
X = rng.integers(2, size=1000)
|
|
98
|
+
y = rng.integers(2, size=1000)
|
|
99
|
+
|
|
100
|
+
X = _convert_to_dataframe(
|
|
101
|
+
X,
|
|
102
|
+
sycl_queue=queue,
|
|
103
|
+
target_df=dataframe,
|
|
104
|
+
dtype=dtype,
|
|
105
|
+
)
|
|
106
|
+
y = _convert_to_dataframe(
|
|
107
|
+
y,
|
|
108
|
+
sycl_queue=queue,
|
|
109
|
+
target_df=dataframe,
|
|
110
|
+
dtype=dtype,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
_ = roc_auc_score(X, y)
|
|
114
|
+
assert all(
|
|
115
|
+
[
|
|
116
|
+
"running accelerated version" in i.message
|
|
117
|
+
or "fallback to original Scikit-learn" in i.message
|
|
118
|
+
for i in caplog.records
|
|
119
|
+
]
|
|
120
|
+
), f"sklearnex patching issue in roc_auc_score with log: \n{caplog.text}"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _check_estimator_patching(caplog, dataframe, queue, dtype, est, method):
|
|
124
|
+
# This should be modified as more array_api frameworks are tested and for
|
|
125
|
+
# upcoming changes in dpnp and dpctl
|
|
126
|
+
|
|
127
|
+
with caplog.at_level(logging.WARNING, logger="sklearnex"):
|
|
128
|
+
X, y = gen_dataset(est, queue=queue, target_df=dataframe, dtype=dtype)[0]
|
|
129
|
+
est.fit(X, y)
|
|
130
|
+
|
|
131
|
+
if method:
|
|
132
|
+
call_method(est, method, X, y)
|
|
133
|
+
|
|
134
|
+
assert all(
|
|
135
|
+
[
|
|
136
|
+
"running accelerated version" in i.message
|
|
137
|
+
or "fallback to original Scikit-learn" in i.message
|
|
138
|
+
for i in caplog.records
|
|
139
|
+
]
|
|
140
|
+
), f"sklearnex patching issue in {estimator}.{method} with log: \n{caplog.text}"
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@pytest.mark.parametrize("dtype", DTYPES)
|
|
144
|
+
@pytest.mark.parametrize("dataframe, queue", get_dataframes_and_queues())
|
|
145
|
+
@pytest.mark.parametrize("estimator, method", gen_models_info(PATCHED_MODELS))
|
|
146
|
+
def test_standard_estimator_patching(caplog, dataframe, queue, dtype, estimator, method):
|
|
147
|
+
est = PATCHED_MODELS[estimator]()
|
|
148
|
+
|
|
149
|
+
if queue:
|
|
150
|
+
if dtype == np.float16 and not queue.sycl_device.has_aspect_fp16:
|
|
151
|
+
pytest.skip("Hardware does not support fp16 SYCL testing")
|
|
152
|
+
elif dtype == np.float64 and not queue.sycl_device.has_aspect_fp64:
|
|
153
|
+
pytest.skip("Hardware does not support fp64 SYCL testing")
|
|
154
|
+
elif queue.sycl_device.is_gpu and estimator in [
|
|
155
|
+
"ElasticNet",
|
|
156
|
+
"Lasso",
|
|
157
|
+
]:
|
|
158
|
+
pytest.skip(f"{estimator} does not support GPU queues")
|
|
159
|
+
|
|
160
|
+
if "NearestNeighbors" in estimator and "radius" in method:
|
|
161
|
+
pytest.skip(f"RadiusNeighbors estimator not implemented in sklearnex")
|
|
162
|
+
|
|
163
|
+
if estimator == "TSNE" and method == "fit_transform":
|
|
164
|
+
pytest.skip("TSNE.fit_transform is too slow for common testing")
|
|
165
|
+
elif estimator == "IncrementalLinearRegression" and np.issubdtype(dtype, np.integer):
|
|
166
|
+
pytest.skip(
|
|
167
|
+
"IncrementalLinearRegression fails on oneDAL side with int types because dataset is filled by zeroes"
|
|
168
|
+
)
|
|
169
|
+
elif method and not hasattr(est, method):
|
|
170
|
+
pytest.skip(f"sklearn available_if prevents testing {estimator}.{method}")
|
|
171
|
+
|
|
172
|
+
if dataframe == "array_api":
|
|
173
|
+
# as array_api dispatching is experimental, sklearn support isn't guaranteed.
|
|
174
|
+
# the infrastructure from sklearn that sklearnex depends on is also susceptible
|
|
175
|
+
# to failure. In this case compare to sklearn for the same failure. By design
|
|
176
|
+
# the patching of sklearn should act similarly. Technically this is conformance.
|
|
177
|
+
if (
|
|
178
|
+
(estimator == "PCA" and "transform" in method)
|
|
179
|
+
or (estimator == "IncrementalEmpiricalCovariance" and method == "mahalanobis")
|
|
180
|
+
) and not _package_check_version("2.0", np.__version__):
|
|
181
|
+
# issue not to be observed with normal numpy usage
|
|
182
|
+
pytest.skip(
|
|
183
|
+
f"numpy backend does not properly handle the __dlpack__ attribute."
|
|
184
|
+
)
|
|
185
|
+
elif (
|
|
186
|
+
not sklearn_check_version("1.3")
|
|
187
|
+
and estimator == "IncrementalEmpiricalCovariance"
|
|
188
|
+
and method == "score"
|
|
189
|
+
):
|
|
190
|
+
pytest.skip(
|
|
191
|
+
f"array checking in sklearn <1.3 does not fully support array_api inputs, causes sklearnex-only estimator failure"
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
with config_context(array_api_dispatch=True):
|
|
195
|
+
try:
|
|
196
|
+
_check_estimator_patching(caplog, dataframe, queue, dtype, est, method)
|
|
197
|
+
except Exception as e:
|
|
198
|
+
# if we are borrowing from sklearn and it fails, then this is something
|
|
199
|
+
# failing on sklearn-side. It is only allowed to fail if the underlying sklearn
|
|
200
|
+
# function doesn't support array_api with the set parameters and array_api
|
|
201
|
+
# support isn't promised by oneDAL
|
|
202
|
+
tags = get_tags(est)
|
|
203
|
+
array_api_check = (
|
|
204
|
+
hasattr(tags, "array_api_support")
|
|
205
|
+
and tags.array_api_support
|
|
206
|
+
or hasattr(tags, "onedal_array_api")
|
|
207
|
+
and tags.onedal_array_api
|
|
208
|
+
)
|
|
209
|
+
if (
|
|
210
|
+
array_api_check
|
|
211
|
+
or estimator not in UNPATCHED_MODELS
|
|
212
|
+
or getattr(PATCHED_MODELS[estimator], method)
|
|
213
|
+
!= getattr(UNPATCHED_MODELS[estimator], method, None)
|
|
214
|
+
):
|
|
215
|
+
raise e
|
|
216
|
+
|
|
217
|
+
else:
|
|
218
|
+
_check_estimator_patching(caplog, dataframe, queue, dtype, est, method)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@pytest.mark.parametrize("dtype", DTYPES)
|
|
222
|
+
@pytest.mark.parametrize("dataframe, queue", get_dataframes_and_queues())
|
|
223
|
+
@pytest.mark.parametrize("estimator, method", gen_models_info(SPECIAL_INSTANCES))
|
|
224
|
+
def test_special_estimator_patching(caplog, dataframe, queue, dtype, estimator, method):
|
|
225
|
+
est = SPECIAL_INSTANCES[estimator]
|
|
226
|
+
|
|
227
|
+
if queue:
|
|
228
|
+
# Its not possible to get the dpnp/dpctl arrays to be in the proper dtype
|
|
229
|
+
if dtype == np.float16 and not queue.sycl_device.has_aspect_fp16:
|
|
230
|
+
pytest.skip("Hardware does not support fp16 SYCL testing")
|
|
231
|
+
elif dtype == np.float64 and not queue.sycl_device.has_aspect_fp64:
|
|
232
|
+
pytest.skip("Hardware does not support fp64 SYCL testing")
|
|
233
|
+
|
|
234
|
+
if "NearestNeighbors" in estimator and "radius" in method:
|
|
235
|
+
pytest.skip(f"RadiusNeighbors estimator not implemented in sklearnex")
|
|
236
|
+
|
|
237
|
+
_check_estimator_patching(caplog, dataframe, queue, dtype, est, method)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
@pytest.mark.parametrize("estimator", UNPATCHED_MODELS.keys())
|
|
241
|
+
def test_standard_estimator_signatures(estimator):
|
|
242
|
+
est = PATCHED_MODELS[estimator]()
|
|
243
|
+
unpatched_est = UNPATCHED_MODELS[estimator]()
|
|
244
|
+
|
|
245
|
+
# all public sklearn methods should have signature matches in sklearnex
|
|
246
|
+
|
|
247
|
+
unpatched_est_methods = [
|
|
248
|
+
i
|
|
249
|
+
for i in dir(unpatched_est)
|
|
250
|
+
if not i.startswith("_") and not i.endswith("_") and hasattr(unpatched_est, i)
|
|
251
|
+
]
|
|
252
|
+
for method in unpatched_est_methods:
|
|
253
|
+
est_method = getattr(est, method)
|
|
254
|
+
unpatched_est_method = getattr(unpatched_est, method)
|
|
255
|
+
if callable(unpatched_est_method):
|
|
256
|
+
regex = rf"(?:sklearn|daal4py)\S*{estimator}" # needed due to differences in module structure
|
|
257
|
+
patched_sig = re.sub(regex, estimator, str(signature(est_method)))
|
|
258
|
+
unpatched_sig = re.sub(regex, estimator, str(signature(unpatched_est_method)))
|
|
259
|
+
assert (
|
|
260
|
+
patched_sig == unpatched_sig
|
|
261
|
+
), f"Signature of {estimator}.{method} does not match sklearn"
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@pytest.mark.parametrize("estimator", UNPATCHED_MODELS.keys())
|
|
265
|
+
def test_standard_estimator_init_signatures(estimator):
|
|
266
|
+
# Several estimators have additional parameters that are user-accessible
|
|
267
|
+
# which are sklearnex-specific. They will fail and are removed from tests.
|
|
268
|
+
# remove n_jobs due to estimator patching for sklearnex (known deviation)
|
|
269
|
+
patched_sig = str(signature(PATCHED_MODELS[estimator].__init__))
|
|
270
|
+
unpatched_sig = str(signature(UNPATCHED_MODELS[estimator].__init__))
|
|
271
|
+
|
|
272
|
+
# Sklearnex allows for positional kwargs and n_jobs, when sklearn doesn't
|
|
273
|
+
for kwarg in ["n_jobs=None", "*"]:
|
|
274
|
+
patched_sig = patched_sig.replace(", " + kwarg, "")
|
|
275
|
+
unpatched_sig = unpatched_sig.replace(", " + kwarg, "")
|
|
276
|
+
|
|
277
|
+
# Special sklearnex-specific kwargs are removed from signatures here
|
|
278
|
+
if estimator in [
|
|
279
|
+
"RandomForestRegressor",
|
|
280
|
+
"RandomForestClassifier",
|
|
281
|
+
"ExtraTreesRegressor",
|
|
282
|
+
"ExtraTreesClassifier",
|
|
283
|
+
]:
|
|
284
|
+
for kwarg in ["min_bin_size=1", "max_bins=256"]:
|
|
285
|
+
patched_sig = patched_sig.replace(", " + kwarg, "")
|
|
286
|
+
|
|
287
|
+
assert (
|
|
288
|
+
patched_sig == unpatched_sig
|
|
289
|
+
), f"Signature of {estimator}.__init__ does not match sklearn"
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@pytest.mark.parametrize(
|
|
293
|
+
"function",
|
|
294
|
+
[
|
|
295
|
+
i
|
|
296
|
+
for i in UNPATCHED_FUNCTIONS.keys()
|
|
297
|
+
if i not in ["train_test_split", "set_config", "config_context"]
|
|
298
|
+
],
|
|
299
|
+
)
|
|
300
|
+
def test_patched_function_signatures(function):
|
|
301
|
+
# certain functions are dropped from the test
|
|
302
|
+
# as they add functionality to the underlying sklearn function
|
|
303
|
+
if not sklearn_check_version("1.1") and function == "_assert_all_finite":
|
|
304
|
+
pytest.skip("Sklearn versioning not added to _assert_all_finite")
|
|
305
|
+
func = PATCHED_FUNCTIONS[function]
|
|
306
|
+
unpatched_func = UNPATCHED_FUNCTIONS[function]
|
|
307
|
+
|
|
308
|
+
if callable(unpatched_func):
|
|
309
|
+
assert str(signature(func)) == str(
|
|
310
|
+
signature(unpatched_func)
|
|
311
|
+
), f"Signature of {func} does not match sklearn"
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def test_patch_map_match():
|
|
315
|
+
# This rule applies to functions and classes which are out of preview.
|
|
316
|
+
# Items listed in a matching submodule's __all__ attribute should be
|
|
317
|
+
# in get_patch_map. There should not be any missing or additional elements.
|
|
318
|
+
|
|
319
|
+
def list_all_attr(string):
|
|
320
|
+
try:
|
|
321
|
+
mod = importlib.import_module(string)
|
|
322
|
+
except ModuleNotFoundError:
|
|
323
|
+
return set([None])
|
|
324
|
+
|
|
325
|
+
# Some sklearn estimators exist in python
|
|
326
|
+
# files rather than folders under sklearn
|
|
327
|
+
modules = set(
|
|
328
|
+
getattr(
|
|
329
|
+
mod, "__all__", [name for name in dir(mod) if not name.startswith("_")]
|
|
330
|
+
)
|
|
331
|
+
)
|
|
332
|
+
return modules
|
|
333
|
+
|
|
334
|
+
if _is_preview_enabled():
|
|
335
|
+
pytest.skip("preview sklearnex has been activated")
|
|
336
|
+
patched = {**PATCHED_MODELS, **PATCHED_FUNCTIONS}
|
|
337
|
+
|
|
338
|
+
sklearnex__all__ = list_all_attr("sklearnex")
|
|
339
|
+
sklearn__all__ = list_all_attr("sklearn")
|
|
340
|
+
|
|
341
|
+
module_map = {i: i for i in sklearnex__all__.intersection(sklearn__all__)}
|
|
342
|
+
|
|
343
|
+
# _assert_all_finite patches an internal sklearn function which isn't
|
|
344
|
+
# exposed via __all__ in sklearn. It is a special case where this rule
|
|
345
|
+
# is not applied (e.g. it is grandfathered in).
|
|
346
|
+
del patched["_assert_all_finite"]
|
|
347
|
+
|
|
348
|
+
# remove all scikit-learn-intelex-only estimators
|
|
349
|
+
for i in patched.copy():
|
|
350
|
+
if i not in UNPATCHED_MODELS and i not in UNPATCHED_FUNCTIONS:
|
|
351
|
+
del patched[i]
|
|
352
|
+
|
|
353
|
+
for module in module_map:
|
|
354
|
+
sklearn_module__all__ = list_all_attr("sklearn." + module_map[module])
|
|
355
|
+
sklearnex_module__all__ = list_all_attr("sklearnex." + module)
|
|
356
|
+
intersect = sklearnex_module__all__.intersection(sklearn_module__all__)
|
|
357
|
+
|
|
358
|
+
for i in intersect:
|
|
359
|
+
if i:
|
|
360
|
+
del patched[i]
|
|
361
|
+
else:
|
|
362
|
+
del patched[module]
|
|
363
|
+
assert patched == {}, f"{patched.keys()} were not properly patched"
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
@pytest.mark.parametrize("estimator", UNPATCHED_MODELS.keys())
|
|
367
|
+
def test_is_patched_instance(estimator):
|
|
368
|
+
patched = PATCHED_MODELS[estimator]
|
|
369
|
+
unpatched = UNPATCHED_MODELS[estimator]
|
|
370
|
+
assert is_patched_instance(patched), f"{patched} is a patched instance"
|
|
371
|
+
assert not is_patched_instance(unpatched), f"{unpatched} is an unpatched instance"
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@pytest.mark.parametrize("estimator", PATCHED_MODELS.keys())
|
|
375
|
+
def test_if_estimator_inherits_sklearn(estimator):
|
|
376
|
+
est = PATCHED_MODELS[estimator]
|
|
377
|
+
if estimator in UNPATCHED_MODELS:
|
|
378
|
+
assert issubclass(
|
|
379
|
+
est, UNPATCHED_MODELS[estimator]
|
|
380
|
+
), f"{estimator} does not inherit from the patched sklearn estimator"
|
|
381
|
+
else:
|
|
382
|
+
assert issubclass(est, BaseEstimator)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
@pytest.mark.parametrize("estimator", UNPATCHED_MODELS.keys())
|
|
386
|
+
def test_docstring_patching_match(estimator):
|
|
387
|
+
patched = PATCHED_MODELS[estimator]
|
|
388
|
+
unpatched = UNPATCHED_MODELS[estimator]
|
|
389
|
+
patched_docstrings = {
|
|
390
|
+
i: getattr(patched, i).__doc__
|
|
391
|
+
for i in dir(patched)
|
|
392
|
+
if not i.startswith("_") and not i.endswith("_") and hasattr(patched, i)
|
|
393
|
+
}
|
|
394
|
+
unpatched_docstrings = {
|
|
395
|
+
i: getattr(unpatched, i).__doc__
|
|
396
|
+
for i in dir(unpatched)
|
|
397
|
+
if not i.startswith("_") and not i.endswith("_") and hasattr(unpatched, i)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
# check class docstring match if a docstring is available
|
|
401
|
+
|
|
402
|
+
assert (patched.__doc__ is None) == (unpatched.__doc__ is None)
|
|
403
|
+
|
|
404
|
+
# check class attribute docstrings
|
|
405
|
+
|
|
406
|
+
for i in unpatched_docstrings:
|
|
407
|
+
assert (patched_docstrings[i] is None) == (unpatched_docstrings[i] is None)
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
@pytest.mark.parametrize("member", ["_onedal_cpu_supported", "_onedal_gpu_supported"])
|
|
411
|
+
@pytest.mark.parametrize(
|
|
412
|
+
"name",
|
|
413
|
+
[i for i in PATCHED_MODELS.keys() if "sklearnex" in PATCHED_MODELS[i].__module__],
|
|
414
|
+
)
|
|
415
|
+
def test_onedal_supported_member(name, member):
|
|
416
|
+
patched = PATCHED_MODELS[name]
|
|
417
|
+
sig = str(signature(getattr(patched, member)))
|
|
418
|
+
assert "(self, method_name, *data)" == sig
|