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,607 @@
|
|
|
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 importlib.util
|
|
18
|
+
import io
|
|
19
|
+
import os
|
|
20
|
+
import pathlib
|
|
21
|
+
import pkgutil
|
|
22
|
+
import re
|
|
23
|
+
import subprocess
|
|
24
|
+
import sys
|
|
25
|
+
import trace
|
|
26
|
+
from contextlib import redirect_stdout
|
|
27
|
+
from multiprocessing import Pipe, Process, get_context
|
|
28
|
+
|
|
29
|
+
import pytest
|
|
30
|
+
from sklearn.base import BaseEstimator
|
|
31
|
+
from sklearn.utils import all_estimators
|
|
32
|
+
|
|
33
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
34
|
+
from onedal.tests.test_common import _check_primitive_usage_ban
|
|
35
|
+
from onedal.tests.utils._dataframes_support import test_frameworks
|
|
36
|
+
from sklearnex.base import oneDALEstimator
|
|
37
|
+
from sklearnex.tests.utils import (
|
|
38
|
+
PATCHED_MODELS,
|
|
39
|
+
SPECIAL_INSTANCES,
|
|
40
|
+
UNPATCHED_MODELS,
|
|
41
|
+
call_method,
|
|
42
|
+
gen_dataset,
|
|
43
|
+
gen_models_info,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
TARGET_OFFLOAD_ALLOWED_LOCATIONS = [
|
|
47
|
+
"_config.py",
|
|
48
|
+
"_device_offload.py",
|
|
49
|
+
"test",
|
|
50
|
+
"svc.py",
|
|
51
|
+
"svm" + os.sep + "_common.py",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
_DESIGN_RULE_VIOLATIONS = {
|
|
55
|
+
"IncrementalEmpiricalCovariance-score-call_validate_data": "must call clone of itself",
|
|
56
|
+
"SVC(probability=True)-fit-call_validate_data": "SVC fit can use sklearn estimator",
|
|
57
|
+
"NuSVC(probability=True)-fit-call_validate_data": "NuSVC fit can use sklearn estimator",
|
|
58
|
+
"LogisticRegression-score-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
59
|
+
"LogisticRegression-fit-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
60
|
+
"LogisticRegression-predict-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
61
|
+
"LogisticRegression-predict_log_proba-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
62
|
+
"LogisticRegression-predict_proba-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
63
|
+
"KNeighborsClassifier-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
64
|
+
"KNeighborsClassifier-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
65
|
+
"KNeighborsClassifier-score-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
66
|
+
"KNeighborsClassifier-predict-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
67
|
+
"KNeighborsClassifier-predict_proba-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
68
|
+
"KNeighborsClassifier-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
69
|
+
"KNeighborsRegressor-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
70
|
+
"KNeighborsRegressor-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
71
|
+
"KNeighborsRegressor-score-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
72
|
+
"KNeighborsRegressor-predict-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
73
|
+
"KNeighborsRegressor-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
74
|
+
"NearestNeighbors-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
75
|
+
"NearestNeighbors-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
76
|
+
"NearestNeighbors-radius_neighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
77
|
+
"NearestNeighbors-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
78
|
+
"NearestNeighbors-radius_neighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
79
|
+
"LocalOutlierFactor-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
80
|
+
"LocalOutlierFactor-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
81
|
+
"LocalOutlierFactor-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
82
|
+
"KNeighborsClassifier(algorithm='brute')-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
83
|
+
"KNeighborsClassifier(algorithm='brute')-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
84
|
+
"KNeighborsClassifier(algorithm='brute')-score-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
85
|
+
"KNeighborsClassifier(algorithm='brute')-predict-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
86
|
+
"KNeighborsClassifier(algorithm='brute')-predict_proba-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
87
|
+
"KNeighborsClassifier(algorithm='brute')-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
88
|
+
"KNeighborsRegressor(algorithm='brute')-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
89
|
+
"KNeighborsRegressor(algorithm='brute')-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
90
|
+
"KNeighborsRegressor(algorithm='brute')-score-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
91
|
+
"KNeighborsRegressor(algorithm='brute')-predict-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
92
|
+
"KNeighborsRegressor(algorithm='brute')-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
93
|
+
"NearestNeighbors(algorithm='brute')-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
94
|
+
"NearestNeighbors(algorithm='brute')-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
95
|
+
"NearestNeighbors(algorithm='brute')-radius_neighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
96
|
+
"NearestNeighbors(algorithm='brute')-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
97
|
+
"NearestNeighbors(algorithm='brute')-radius_neighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
98
|
+
"LocalOutlierFactor(novelty=True)-fit-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
99
|
+
"LocalOutlierFactor(novelty=True)-kneighbors-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
100
|
+
"LocalOutlierFactor(novelty=True)-kneighbors_graph-n_jobs_check": "uses daal4py for cpu in onedal",
|
|
101
|
+
"LogisticRegression(solver='newton-cg')-score-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
102
|
+
"LogisticRegression(solver='newton-cg')-fit-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
103
|
+
"LogisticRegression(solver='newton-cg')-predict-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
104
|
+
"LogisticRegression(solver='newton-cg')-predict_log_proba-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
105
|
+
"LogisticRegression(solver='newton-cg')-predict_proba-n_jobs_check": "uses daal4py for cpu in sklearnex",
|
|
106
|
+
"DummyRegressor-fit-n_jobs_check": "default parameters use sklearn",
|
|
107
|
+
"DummyRegressor-predict-n_jobs_check": "default parameters use sklearn",
|
|
108
|
+
"DummyRegressor-score-n_jobs_check": "default parameters use sklearn",
|
|
109
|
+
# KNeighborsClassifier validate_data issues - will be fixed later
|
|
110
|
+
"KNeighborsClassifier-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
111
|
+
"KNeighborsClassifier-predict_proba-call_validate_data": "validate_data implementation needs fixing",
|
|
112
|
+
"KNeighborsClassifier-score-call_validate_data": "validate_data implementation needs fixing",
|
|
113
|
+
"KNeighborsClassifier-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
114
|
+
"KNeighborsClassifier-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
115
|
+
"KNeighborsClassifier-predict-call_validate_data": "validate_data implementation needs fixing",
|
|
116
|
+
"KNeighborsRegressor-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
117
|
+
"KNeighborsRegressor-score-call_validate_data": "validate_data implementation needs fixing",
|
|
118
|
+
"KNeighborsRegressor-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
119
|
+
"KNeighborsRegressor-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
120
|
+
"KNeighborsRegressor-predict-call_validate_data": "validate_data implementation needs fixing",
|
|
121
|
+
"NearestNeighbors-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
122
|
+
"NearestNeighbors-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
123
|
+
"NearestNeighbors-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
124
|
+
"LocalOutlierFactor-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
125
|
+
"LocalOutlierFactor-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
126
|
+
"LocalOutlierFactor-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
127
|
+
"LocalOutlierFactor(novelty=True)-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
128
|
+
"LocalOutlierFactor(novelty=True)-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
129
|
+
"LocalOutlierFactor(novelty=True)-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
130
|
+
"KNeighborsClassifier(algorithm='brute')-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
131
|
+
"KNeighborsClassifier(algorithm='brute')-predict_proba-call_validate_data": "validate_data implementation needs fixing",
|
|
132
|
+
"KNeighborsClassifier(algorithm='brute')-score-call_validate_data": "validate_data implementation needs fixing",
|
|
133
|
+
"KNeighborsClassifier(algorithm='brute')-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
134
|
+
"KNeighborsClassifier(algorithm='brute')-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
135
|
+
"KNeighborsClassifier(algorithm='brute')-predict-call_validate_data": "validate_data implementation needs fixing",
|
|
136
|
+
"KNeighborsRegressor(algorithm='brute')-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
137
|
+
"KNeighborsRegressor(algorithm='brute')-score-call_validate_data": "validate_data implementation needs fixing",
|
|
138
|
+
"KNeighborsRegressor(algorithm='brute')-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
139
|
+
"KNeighborsRegressor(algorithm='brute')-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
140
|
+
"KNeighborsRegressor(algorithm='brute')-predict-call_validate_data": "validate_data implementation needs fixing",
|
|
141
|
+
"NearestNeighbors(algorithm='brute')-fit-call_validate_data": "validate_data implementation needs fixing",
|
|
142
|
+
"NearestNeighbors(algorithm='brute')-kneighbors-call_validate_data": "validate_data implementation needs fixing",
|
|
143
|
+
"NearestNeighbors(algorithm='brute')-kneighbors_graph-call_validate_data": "validate_data implementation needs fixing",
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def test_target_offload_ban():
|
|
148
|
+
"""This test blocks the use of target_offload in
|
|
149
|
+
in sklearnex files. Offloading computation to devices
|
|
150
|
+
via target_offload should only occur externally, and not
|
|
151
|
+
within the architecture of the sklearnex classes. This
|
|
152
|
+
is for clarity, traceability and maintainability.
|
|
153
|
+
"""
|
|
154
|
+
output = _check_primitive_usage_ban(
|
|
155
|
+
primitive_name="target_offload",
|
|
156
|
+
package="sklearnex",
|
|
157
|
+
allowed_locations=TARGET_OFFLOAD_ALLOWED_LOCATIONS,
|
|
158
|
+
)
|
|
159
|
+
output = "\n".join(output)
|
|
160
|
+
assert output == "", f"target offloading is occurring in: \n{output}"
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _sklearnex_walk(func):
|
|
164
|
+
"""this replaces checks on pkgutils to look through sklearnex
|
|
165
|
+
folders specifically"""
|
|
166
|
+
|
|
167
|
+
def wrap(*args, **kwargs):
|
|
168
|
+
if "prefix" in kwargs and kwargs["prefix"] == "sklearn.":
|
|
169
|
+
kwargs["prefix"] = "sklearnex."
|
|
170
|
+
if "path" in kwargs:
|
|
171
|
+
# force root to sklearnex
|
|
172
|
+
kwargs["path"] = [str(pathlib.Path(__file__).parent.parent)]
|
|
173
|
+
for pkginfo in func(*args, **kwargs):
|
|
174
|
+
# Do not allow spmd to be yielded
|
|
175
|
+
if "spmd" not in pkginfo.name.split("."):
|
|
176
|
+
yield pkginfo
|
|
177
|
+
|
|
178
|
+
return wrap
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_class_trailing_underscore_ban(monkeypatch):
|
|
182
|
+
"""Trailing underscores are defined for sklearn to be signatures of a fitted
|
|
183
|
+
estimator instance, sklearnex extends this to the classes as well"""
|
|
184
|
+
monkeypatch.setattr(pkgutil, "walk_packages", _sklearnex_walk(pkgutil.walk_packages))
|
|
185
|
+
estimators = all_estimators() # list of tuples
|
|
186
|
+
for name, obj in estimators:
|
|
187
|
+
if "preview" not in obj.__module__ and "daal4py" not in obj.__module__:
|
|
188
|
+
# properties also occur in sklearn, especially in deprecations and are expected
|
|
189
|
+
# to error if queried and the estimator is not fitted
|
|
190
|
+
assert all(
|
|
191
|
+
[
|
|
192
|
+
isinstance(getattr(obj, attr), property)
|
|
193
|
+
or (attr.startswith("_") or not attr.endswith("_"))
|
|
194
|
+
for attr in dir(obj)
|
|
195
|
+
]
|
|
196
|
+
), f"{name} contains class attributes which have a trailing underscore but no leading one"
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def test_all_estimators_covered(monkeypatch):
|
|
200
|
+
"""Check that all estimators defined in sklearnex are available in either the
|
|
201
|
+
patch map or covered in special testing via SPECIAL_INSTANCES. The estimator
|
|
202
|
+
must inherit sklearn's BaseEstimator and must not have a leading underscore.
|
|
203
|
+
The sklearnex.spmd and sklearnex.preview packages are not tested.
|
|
204
|
+
"""
|
|
205
|
+
monkeypatch.setattr(pkgutil, "walk_packages", _sklearnex_walk(pkgutil.walk_packages))
|
|
206
|
+
estimators = all_estimators() # list of tuples
|
|
207
|
+
uncovered_estimators = []
|
|
208
|
+
for name, obj in estimators:
|
|
209
|
+
# do nothing if defined in preview
|
|
210
|
+
if "preview" not in obj.__module__ and not (
|
|
211
|
+
any([issubclass(est, obj) for est in PATCHED_MODELS.values()])
|
|
212
|
+
or any([issubclass(est.__class__, obj) for est in SPECIAL_INSTANCES.values()])
|
|
213
|
+
):
|
|
214
|
+
uncovered_estimators += [".".join([obj.__module__, name])]
|
|
215
|
+
|
|
216
|
+
assert (
|
|
217
|
+
uncovered_estimators == []
|
|
218
|
+
), f"{uncovered_estimators} are currently not included"
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def test_oneDALEstimator_inheritance(monkeypatch):
|
|
222
|
+
"""All sklearnex estimators should inherit the oneDALEstimator class, sklearnex-only
|
|
223
|
+
estimators should have it inherit oneDAL estimator one step before BaseEstimator in the
|
|
224
|
+
mro. This is only strictly set for non-preview estimators"""
|
|
225
|
+
monkeypatch.setattr(pkgutil, "walk_packages", _sklearnex_walk(pkgutil.walk_packages))
|
|
226
|
+
estimators = all_estimators() # list of tuples
|
|
227
|
+
for name, obj in estimators:
|
|
228
|
+
if "preview" not in obj.__module__ and "daal4py" not in obj.__module__:
|
|
229
|
+
assert issubclass(
|
|
230
|
+
obj, oneDALEstimator
|
|
231
|
+
), f"{name} does not inherit the oneDALEstimator"
|
|
232
|
+
# oneDAL estimator should be inherited from before BaseEstimator
|
|
233
|
+
mro = obj.__mro__
|
|
234
|
+
assert mro.index(oneDALEstimator) < mro.index(
|
|
235
|
+
BaseEstimator
|
|
236
|
+
), f"incorrect mro in {name}"
|
|
237
|
+
if not any([issubclass(obj, est) for est in UNPATCHED_MODELS.values()]):
|
|
238
|
+
assert (
|
|
239
|
+
mro[mro.index(oneDALEstimator) + 1] is BaseEstimator
|
|
240
|
+
), f"oneDALEstimator should be inherited just before BaseEstimator in {name}"
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def test_frameworks_lazy_import(monkeypatch):
|
|
244
|
+
"""Check that all estimators defined in sklearnex do not actively
|
|
245
|
+
load data frameworks which are not numpy or pandas.
|
|
246
|
+
"""
|
|
247
|
+
active = ["numpy", "pandas", "dpctl.tensor"]
|
|
248
|
+
# handle naming conventions for data frameworks in testing
|
|
249
|
+
frameworks = test_frameworks.replace("dpctl", "dpctl.tensor")
|
|
250
|
+
frameworks = frameworks.replace("array_api", "array_api_strict")
|
|
251
|
+
lazy = ",".join([i for i in frameworks.split(",") if i not in active])
|
|
252
|
+
if not lazy:
|
|
253
|
+
pytest.skip("No lazily-imported data frameworks available in testing")
|
|
254
|
+
|
|
255
|
+
monkeypatch.setattr(pkgutil, "walk_packages", _sklearnex_walk(pkgutil.walk_packages))
|
|
256
|
+
estimators = all_estimators() # list of tuples
|
|
257
|
+
|
|
258
|
+
filtered_modules = []
|
|
259
|
+
for name, obj in estimators:
|
|
260
|
+
# do not test spmd or preview, as they are exempt
|
|
261
|
+
if "preview" not in obj.__module__ and "spmd" not in obj.__module__:
|
|
262
|
+
filtered_modules += [obj.__module__]
|
|
263
|
+
|
|
264
|
+
modules = ",".join(filtered_modules)
|
|
265
|
+
|
|
266
|
+
# import all modules with estimators and check sys.modules for the lazily-imported data
|
|
267
|
+
# frameworks. It is done in a subprocess to isolate the impact of testing infrastructure
|
|
268
|
+
# on sys.modules, which may have actively loaded those frameworks into the test env
|
|
269
|
+
teststr = (
|
|
270
|
+
"import sys,{mod};assert all([i not in sys.modules for i in '{l}'.split(',')])"
|
|
271
|
+
)
|
|
272
|
+
cmd = [sys.executable, "-c", teststr.format(mod=modules, l=lazy)]
|
|
273
|
+
|
|
274
|
+
try:
|
|
275
|
+
subprocess.run(cmd, check=True, capture_output=True, text=True)
|
|
276
|
+
except subprocess.CalledProcessError as e:
|
|
277
|
+
raise AssertionError(f"a framework in '{lazy}' is being actively loaded") from e
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def _fullpath(path):
|
|
281
|
+
return os.path.realpath(os.path.expanduser(path))
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
_TRACE_ALLOW_DICT = {
|
|
285
|
+
i: _fullpath(os.path.dirname(importlib.util.find_spec(i).origin))
|
|
286
|
+
for i in ["sklearn", "sklearnex", "onedal", "daal4py"]
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def _whitelist_to_blacklist():
|
|
291
|
+
"""block all standard library, built-in or site packages which are not
|
|
292
|
+
related to sklearn, daal4py, onedal or sklearnex"""
|
|
293
|
+
|
|
294
|
+
def _commonpath(inp):
|
|
295
|
+
# ValueError generated by os.path.commonpath when it is on a separate drive
|
|
296
|
+
try:
|
|
297
|
+
return os.path.commonpath(inp)
|
|
298
|
+
except ValueError:
|
|
299
|
+
return ""
|
|
300
|
+
|
|
301
|
+
blacklist = []
|
|
302
|
+
for path in sys.path:
|
|
303
|
+
fpath = _fullpath(path)
|
|
304
|
+
try:
|
|
305
|
+
# if candidate path is a parent directory to any directory in the whitelist
|
|
306
|
+
if any(
|
|
307
|
+
[_commonpath([i, fpath]) == fpath for i in _TRACE_ALLOW_DICT.values()]
|
|
308
|
+
):
|
|
309
|
+
# find all sub-paths which are not in the whitelist and block them
|
|
310
|
+
# they should not have a common path that is either the whitelist path
|
|
311
|
+
# or the sub-path (meaning one is a parent directory of the either)
|
|
312
|
+
for f in os.scandir(fpath):
|
|
313
|
+
temppath = _fullpath(f.path)
|
|
314
|
+
if all(
|
|
315
|
+
[
|
|
316
|
+
_commonpath([i, temppath]) not in [i, temppath]
|
|
317
|
+
for i in _TRACE_ALLOW_DICT.values()
|
|
318
|
+
]
|
|
319
|
+
):
|
|
320
|
+
blacklist += [temppath]
|
|
321
|
+
# add path to blacklist if not a sub path of anything in the whitelist
|
|
322
|
+
elif all([_commonpath([i, fpath]) != i for i in _TRACE_ALLOW_DICT.values()]):
|
|
323
|
+
blacklist += [fpath]
|
|
324
|
+
except FileNotFoundError:
|
|
325
|
+
blacklist += [fpath]
|
|
326
|
+
return blacklist
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
_TRACE_BLOCK_LIST = _whitelist_to_blacklist()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def sklearnex_trace(estimator_name, method_name):
|
|
333
|
+
"""Generate a trace of all function calls in calling estimator.method.
|
|
334
|
+
|
|
335
|
+
Parameters
|
|
336
|
+
----------
|
|
337
|
+
estimator_name : str
|
|
338
|
+
name of estimator which is a key from PATCHED_MODELS or SPECIAL_INSTANCES
|
|
339
|
+
|
|
340
|
+
method_name : str
|
|
341
|
+
name of estimator method which is to be traced and stored
|
|
342
|
+
|
|
343
|
+
Returns
|
|
344
|
+
-------
|
|
345
|
+
text: str
|
|
346
|
+
Returns a string output (captured stdout of a python Trace call). It is a
|
|
347
|
+
modified version to be more informative, completed by a monkeypatching
|
|
348
|
+
of trace._modname.
|
|
349
|
+
"""
|
|
350
|
+
# get estimator
|
|
351
|
+
est = (
|
|
352
|
+
PATCHED_MODELS[estimator_name]()
|
|
353
|
+
if estimator_name in PATCHED_MODELS
|
|
354
|
+
else SPECIAL_INSTANCES[estimator_name]
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
# get dataset
|
|
358
|
+
X, y = gen_dataset(est)[0]
|
|
359
|
+
# fit dataset if method does not contain 'fit'
|
|
360
|
+
if "fit" not in method_name:
|
|
361
|
+
est.fit(X, y)
|
|
362
|
+
|
|
363
|
+
# monkeypatch new modname for clearer info
|
|
364
|
+
orig_modname = trace._modname
|
|
365
|
+
try:
|
|
366
|
+
# initialize tracer to have a more verbose module naming
|
|
367
|
+
# this impacts ignoremods, but it is not used.
|
|
368
|
+
trace._modname = _fullpath
|
|
369
|
+
tracer = trace.Trace(
|
|
370
|
+
count=0,
|
|
371
|
+
trace=1,
|
|
372
|
+
ignoredirs=_TRACE_BLOCK_LIST,
|
|
373
|
+
)
|
|
374
|
+
# call trace on method with dataset
|
|
375
|
+
f = io.StringIO()
|
|
376
|
+
with redirect_stdout(f):
|
|
377
|
+
tracer.runfunc(call_method, est, method_name, X, y)
|
|
378
|
+
return f.getvalue()
|
|
379
|
+
finally:
|
|
380
|
+
trace._modname = orig_modname
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def _trace_daemon(pipe):
|
|
384
|
+
"""function interface for the other process. Information
|
|
385
|
+
exchanged using a multiprocess.Pipe"""
|
|
386
|
+
# a sent value with inherent conversion to False will break
|
|
387
|
+
# the while loop and complete the function
|
|
388
|
+
while key := pipe.recv():
|
|
389
|
+
try:
|
|
390
|
+
text = sklearnex_trace(*key)
|
|
391
|
+
except:
|
|
392
|
+
# catch all exceptions and pass back,
|
|
393
|
+
# this way the process still runs
|
|
394
|
+
text = ""
|
|
395
|
+
finally:
|
|
396
|
+
pipe.send(text)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class _FakePipe:
|
|
400
|
+
"""Minimalistic representation of a multiprocessing.Pipe for test development.
|
|
401
|
+
This allows for running sklearnex_trace in the parent process"""
|
|
402
|
+
|
|
403
|
+
_text = ""
|
|
404
|
+
|
|
405
|
+
def send(self, key):
|
|
406
|
+
self._text = sklearnex_trace(*key)
|
|
407
|
+
|
|
408
|
+
def recv(self):
|
|
409
|
+
return self._text
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
@pytest.fixture(scope="module")
|
|
413
|
+
def isolated_trace():
|
|
414
|
+
"""Generates a separate python process for isolated sklearnex traces.
|
|
415
|
+
|
|
416
|
+
It is a module scope fixture due to the overhead of importing all the
|
|
417
|
+
various dependencies and is done once before all the various tests.
|
|
418
|
+
Each test will first check a cached value, if not existent it will have
|
|
419
|
+
the waiting child process generate the trace and return the text for
|
|
420
|
+
caching on its behalf. The isolated process is stopped at test teardown.
|
|
421
|
+
|
|
422
|
+
Yields
|
|
423
|
+
-------
|
|
424
|
+
pipe_parent: multiprocessing.Connection
|
|
425
|
+
one end of a duplex pipe to be used by other pytest fixtures for
|
|
426
|
+
communicating with the special isolated tracing python instance
|
|
427
|
+
for sklearnex estimators.
|
|
428
|
+
"""
|
|
429
|
+
# yield _FakePipe()
|
|
430
|
+
try:
|
|
431
|
+
# force use of 'spawn' to guarantee a clean python environment
|
|
432
|
+
# from possible coverage arc tracing
|
|
433
|
+
ctx = get_context("spawn")
|
|
434
|
+
pipe_parent, pipe_child = ctx.Pipe()
|
|
435
|
+
p = ctx.Process(target=_trace_daemon, args=(pipe_child,), daemon=True)
|
|
436
|
+
p.start()
|
|
437
|
+
yield pipe_parent
|
|
438
|
+
finally:
|
|
439
|
+
# guarantee closing of the process via a try-catch-finally
|
|
440
|
+
# passing False terminates _trace_daemon's loop
|
|
441
|
+
pipe_parent.send(False)
|
|
442
|
+
pipe_parent.close()
|
|
443
|
+
pipe_child.close()
|
|
444
|
+
p.join()
|
|
445
|
+
p.close()
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
@pytest.fixture
|
|
449
|
+
def estimator_trace(estimator, method, cache, isolated_trace):
|
|
450
|
+
"""Create cache of all function calls in calling estimator.method.
|
|
451
|
+
|
|
452
|
+
Parameters
|
|
453
|
+
----------
|
|
454
|
+
estimator : str
|
|
455
|
+
name of estimator which is a key from PATCHED_MODELS or SPECIAL_INSTANCES
|
|
456
|
+
|
|
457
|
+
method : str
|
|
458
|
+
name of estimator method which is to be traced and stored
|
|
459
|
+
|
|
460
|
+
cache: pytest.fixture (standard)
|
|
461
|
+
|
|
462
|
+
isolated_trace: pytest.fixture (test_common.py)
|
|
463
|
+
|
|
464
|
+
Returns
|
|
465
|
+
-------
|
|
466
|
+
dict: [calledfuncs, tracetext, modules, callinglines]
|
|
467
|
+
Returns a list of important attributes of the trace.
|
|
468
|
+
calledfuncs is the list of called functions, tracetext is the
|
|
469
|
+
total text output of the trace as a string, modules are the
|
|
470
|
+
module locations of the called functions (must be from daal4py,
|
|
471
|
+
onedal, sklearn, or sklearnex), and callinglines is the line
|
|
472
|
+
which calls the function in calledfuncs
|
|
473
|
+
"""
|
|
474
|
+
key = "-".join((str(estimator), method))
|
|
475
|
+
flag = cache.get("key", "") != key
|
|
476
|
+
if flag:
|
|
477
|
+
|
|
478
|
+
isolated_trace.send((estimator, method))
|
|
479
|
+
text = isolated_trace.recv()
|
|
480
|
+
# if tracing does not function in isolated_trace, run it in parent process and error
|
|
481
|
+
if text == "":
|
|
482
|
+
sklearnex_trace(estimator, method)
|
|
483
|
+
# guarantee failure if intermittent
|
|
484
|
+
assert text, f"sklearnex_trace failure for {estimator}.{method}"
|
|
485
|
+
|
|
486
|
+
for modulename, file in _TRACE_ALLOW_DICT.items():
|
|
487
|
+
text = text.replace(file, modulename)
|
|
488
|
+
regex_func = (
|
|
489
|
+
r"(?<=funcname: )\S*(?=\n)" # needed due to differences in module structure
|
|
490
|
+
)
|
|
491
|
+
regex_mod = r"(?<=--- modulename: )\S*(?=\.py)" # needed due to differences in module structure
|
|
492
|
+
|
|
493
|
+
regex_callingline = r"(?<=\n)\S.*(?=\n --- modulename: )"
|
|
494
|
+
|
|
495
|
+
cache.set("key", key)
|
|
496
|
+
cache.set(
|
|
497
|
+
"text",
|
|
498
|
+
{
|
|
499
|
+
"funcs": re.findall(regex_func, text),
|
|
500
|
+
"trace": text,
|
|
501
|
+
"modules": [i.replace(os.sep, ".") for i in re.findall(regex_mod, text)],
|
|
502
|
+
"callingline": [""] + re.findall(regex_callingline, text),
|
|
503
|
+
},
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
return cache.get("text", None)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
def call_validate_data(text, estimator, method):
|
|
510
|
+
"""test that both sklearnex wrapper for validate_data and
|
|
511
|
+
original sklearn function/method validate_data are
|
|
512
|
+
called once before offloading to oneDAL in sklearnex"""
|
|
513
|
+
try:
|
|
514
|
+
# get last to_table call showing end of oneDAL input portion of code
|
|
515
|
+
idx = len(text["funcs"]) - 1 - text["funcs"][::-1].index("to_table")
|
|
516
|
+
valid_funcs = text["funcs"][:idx]
|
|
517
|
+
valid_modules = text["modules"][:idx]
|
|
518
|
+
except ValueError:
|
|
519
|
+
pytest.skip("onedal backend not used in this function")
|
|
520
|
+
|
|
521
|
+
validate_data_calls = []
|
|
522
|
+
for func, module in zip(valid_funcs, valid_modules):
|
|
523
|
+
if func.endswith("validate_data"):
|
|
524
|
+
validate_data_calls.append({module, func})
|
|
525
|
+
|
|
526
|
+
assert (
|
|
527
|
+
len(validate_data_calls) == 2
|
|
528
|
+
), "validate_data should be called two times: once for sklearn and once for sklearnex"
|
|
529
|
+
assert validate_data_calls[0] == {
|
|
530
|
+
"sklearnex.utils.validation",
|
|
531
|
+
"validate_data",
|
|
532
|
+
}, "sklearnex's validate_data should be called first"
|
|
533
|
+
assert (
|
|
534
|
+
(validate_data_calls[1] == {"sklearn.utils.validation", "validate_data"})
|
|
535
|
+
if sklearn_check_version("1.6")
|
|
536
|
+
else (validate_data_calls[1] == {"sklearn.base", "_validate_data"})
|
|
537
|
+
), "sklearn's validate_data should be called second"
|
|
538
|
+
assert (
|
|
539
|
+
valid_funcs.count("_check_feature_names") == 1
|
|
540
|
+
), "estimator should check feature names in validate_data"
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
def n_jobs_check(text, estimator, method):
|
|
544
|
+
"""verify the n_jobs is being set if '_get_backend' or 'to_table' is called"""
|
|
545
|
+
# remove the _get_backend function from sklearnex from considered _get_backend
|
|
546
|
+
count = max(
|
|
547
|
+
text["funcs"].count("to_table"),
|
|
548
|
+
len(
|
|
549
|
+
[
|
|
550
|
+
i
|
|
551
|
+
for i in range(len(text["funcs"]))
|
|
552
|
+
if text["funcs"][i] == "_get_backend"
|
|
553
|
+
and "sklearnex" not in text["modules"][i]
|
|
554
|
+
]
|
|
555
|
+
),
|
|
556
|
+
)
|
|
557
|
+
n_jobs_count = text["funcs"].count("n_jobs_wrapper")
|
|
558
|
+
|
|
559
|
+
assert bool(count) == bool(
|
|
560
|
+
n_jobs_count
|
|
561
|
+
), f"verify if {method} should be in control_n_jobs' decorated_methods for {estimator}"
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def runtime_property_check(text, estimator, method):
|
|
565
|
+
"""use of Python's 'property' should not be used at runtime, only at class instantiation"""
|
|
566
|
+
assert (
|
|
567
|
+
len(re.findall(r"property\(", text["trace"])) == 0
|
|
568
|
+
), f"{estimator}.{method} should only use 'property' at instantiation"
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def fit_check_before_support_check(text, estimator, method):
|
|
572
|
+
if "fit" not in method:
|
|
573
|
+
if "dispatch" not in text["funcs"]:
|
|
574
|
+
pytest.skip(f"onedal dispatching not used in {estimator}.{method}")
|
|
575
|
+
idx = len(text["funcs"]) - 1 - text["funcs"][::-1].index("dispatch")
|
|
576
|
+
validfuncs = text["funcs"][:idx]
|
|
577
|
+
assert (
|
|
578
|
+
"check_is_fitted" in validfuncs
|
|
579
|
+
), f"sklearn's check_is_fitted must be called before checking oneDAL support"
|
|
580
|
+
|
|
581
|
+
else:
|
|
582
|
+
pytest.skip(f"fitting occurs in {estimator}.{method}")
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
DESIGN_RULES = [
|
|
586
|
+
n_jobs_check,
|
|
587
|
+
runtime_property_check,
|
|
588
|
+
fit_check_before_support_check,
|
|
589
|
+
call_validate_data,
|
|
590
|
+
]
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
@pytest.mark.parametrize("design_pattern", DESIGN_RULES)
|
|
594
|
+
@pytest.mark.parametrize(
|
|
595
|
+
"estimator, method",
|
|
596
|
+
gen_models_info({**PATCHED_MODELS, **SPECIAL_INSTANCES}, fit=True, daal4py=False),
|
|
597
|
+
)
|
|
598
|
+
def test_estimator(estimator, method, design_pattern, estimator_trace):
|
|
599
|
+
# These tests only apply to sklearnex estimators
|
|
600
|
+
try:
|
|
601
|
+
design_pattern(estimator_trace, estimator, method)
|
|
602
|
+
except AssertionError:
|
|
603
|
+
key = "-".join([estimator, method, design_pattern.__name__])
|
|
604
|
+
if key in _DESIGN_RULE_VIOLATIONS:
|
|
605
|
+
pytest.xfail(_DESIGN_RULE_VIOLATIONS[key])
|
|
606
|
+
else:
|
|
607
|
+
raise
|