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,256 @@
|
|
|
1
|
+
# ===============================================================================
|
|
2
|
+
# Copyright 2024 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ===============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pytest
|
|
19
|
+
from numpy.testing import assert_allclose
|
|
20
|
+
from sklearn.exceptions import NotFittedError
|
|
21
|
+
|
|
22
|
+
from daal4py.sklearn._utils import daal_check_version
|
|
23
|
+
from daal4py.sklearn.linear_model.tests.test_ridge import (
|
|
24
|
+
_test_multivariate_ridge_alpha_shape,
|
|
25
|
+
_test_multivariate_ridge_coefficients,
|
|
26
|
+
)
|
|
27
|
+
from onedal.tests.utils._dataframes_support import (
|
|
28
|
+
_as_numpy,
|
|
29
|
+
_convert_to_dataframe,
|
|
30
|
+
get_dataframes_and_queues,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _compute_ridge_coefficients(X, y, alpha, fit_intercept):
|
|
35
|
+
"""
|
|
36
|
+
Computes Ridge regression coefficients for single or multiple target variables.
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
X : array-like of shape (n_samples, n_features)
|
|
40
|
+
Training data.
|
|
41
|
+
y : array-like of shape (n_samples,) or (n_samples, n_targets)
|
|
42
|
+
Target values.
|
|
43
|
+
alpha : float
|
|
44
|
+
Regularization strength.
|
|
45
|
+
fit_intercept : bool
|
|
46
|
+
Whether to calculate the intercept for this model.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
coeffs : ndarray of shape (n_features, n_targets)
|
|
50
|
+
Estimated coefficients for each target variable.
|
|
51
|
+
intercept : ndarray of shape (n_targets,)
|
|
52
|
+
Intercept terms for each target variable.
|
|
53
|
+
"""
|
|
54
|
+
n_samples, n_features = X.shape
|
|
55
|
+
X_copy = X.copy()
|
|
56
|
+
y = np.asarray(y)
|
|
57
|
+
|
|
58
|
+
# making single-target y also multi-dim array for consistency
|
|
59
|
+
if y.ndim == 1:
|
|
60
|
+
y = y[:, np.newaxis]
|
|
61
|
+
n_targets = y.shape[1]
|
|
62
|
+
|
|
63
|
+
if fit_intercept:
|
|
64
|
+
# adding column of ones to X for the intercept term
|
|
65
|
+
X_copy = np.hstack([np.ones((n_samples, 1)), X])
|
|
66
|
+
identity_matrix = np.diag([0] + [1] * n_features)
|
|
67
|
+
else:
|
|
68
|
+
identity_matrix = np.eye(n_features)
|
|
69
|
+
|
|
70
|
+
# normal equation: (X^T * X + alpha * I) * w = X^T * y
|
|
71
|
+
A = X_copy.T @ X_copy + alpha * identity_matrix
|
|
72
|
+
b = X_copy.T @ y
|
|
73
|
+
coeffs = np.linalg.solve(A, b)
|
|
74
|
+
|
|
75
|
+
if fit_intercept:
|
|
76
|
+
intercept = coeffs[0, :] # Shape (n_targets,)
|
|
77
|
+
coeffs = coeffs[1:, :] # Shape (n_features, n_targets)
|
|
78
|
+
else:
|
|
79
|
+
intercept = np.zeros((n_targets,)) # Shape (n_targets,)
|
|
80
|
+
|
|
81
|
+
# in case of single target, flattening both coefficients and intercept
|
|
82
|
+
if n_targets == 1:
|
|
83
|
+
coeffs = coeffs.flatten()
|
|
84
|
+
intercept = intercept[0]
|
|
85
|
+
else:
|
|
86
|
+
coeffs = coeffs.T
|
|
87
|
+
|
|
88
|
+
return coeffs, intercept
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
92
|
+
def test_sklearnex_import_ridge(dataframe, queue):
|
|
93
|
+
from sklearnex.linear_model import Ridge
|
|
94
|
+
|
|
95
|
+
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
|
|
96
|
+
y = np.dot(X, np.array([1, 2])) + 3
|
|
97
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
98
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
99
|
+
ridge_reg = Ridge(alpha=0.5).fit(X_c, y_c)
|
|
100
|
+
|
|
101
|
+
if daal_check_version((2024, "P", 600)):
|
|
102
|
+
assert (
|
|
103
|
+
"sklearnex" in ridge_reg.__module__ and "preview" not in ridge_reg.__module__
|
|
104
|
+
)
|
|
105
|
+
else:
|
|
106
|
+
assert "daal4py" in ridge_reg.__module__
|
|
107
|
+
|
|
108
|
+
assert_allclose(ridge_reg.intercept_, 3.86, rtol=1e-2)
|
|
109
|
+
assert_allclose(ridge_reg.coef_, [0.91, 1.64], rtol=1e-2)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
113
|
+
@pytest.mark.parametrize("sample_size", [100, 1000])
|
|
114
|
+
@pytest.mark.parametrize("feature_size", [10, 50])
|
|
115
|
+
@pytest.mark.parametrize("alpha", [0.1, 0.5, 1.0])
|
|
116
|
+
@pytest.mark.parametrize("fit_intercept", [True, False])
|
|
117
|
+
def test_ridge_coefficients(
|
|
118
|
+
dataframe, queue, sample_size, feature_size, alpha, fit_intercept
|
|
119
|
+
):
|
|
120
|
+
from sklearnex.linear_model import Ridge
|
|
121
|
+
|
|
122
|
+
X = np.random.rand(sample_size, feature_size)
|
|
123
|
+
y = np.random.rand(sample_size)
|
|
124
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
125
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
126
|
+
ridge_reg = Ridge(fit_intercept=fit_intercept, alpha=alpha).fit(X_c, y_c)
|
|
127
|
+
|
|
128
|
+
coefficients_manual, intercept_manual = _compute_ridge_coefficients(
|
|
129
|
+
X, y, alpha, fit_intercept=fit_intercept
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
assert_allclose(ridge_reg.coef_, coefficients_manual, rtol=1e-6, atol=1e-6)
|
|
133
|
+
assert_allclose(ridge_reg.intercept_, intercept_manual, rtol=1e-6, atol=1e-6)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@pytest.mark.skipif(
|
|
137
|
+
not daal_check_version((2024, "P", 600)), reason="requires onedal 2024.6.0 or higher"
|
|
138
|
+
)
|
|
139
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
140
|
+
def test_ridge_score_before_fit(dataframe, queue):
|
|
141
|
+
from sklearnex.linear_model import Ridge
|
|
142
|
+
|
|
143
|
+
sample_count, feature_count = 10, 5
|
|
144
|
+
|
|
145
|
+
model = Ridge(fit_intercept=True, alpha=0.5)
|
|
146
|
+
|
|
147
|
+
X, y = np.random.rand(sample_count, feature_count), np.random.rand(sample_count)
|
|
148
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
149
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
150
|
+
|
|
151
|
+
with pytest.raises(NotFittedError):
|
|
152
|
+
model.score(X_c, y_c)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@pytest.mark.skipif(
|
|
156
|
+
not daal_check_version((2024, "P", 600)), reason="requires onedal 2024.6.0 or higher"
|
|
157
|
+
)
|
|
158
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
159
|
+
def test_ridge_predict_before_fit(dataframe, queue):
|
|
160
|
+
from sklearnex.linear_model import Ridge
|
|
161
|
+
|
|
162
|
+
sample_count, feature_count = 10, 5
|
|
163
|
+
|
|
164
|
+
model = Ridge(fit_intercept=True, alpha=0.5)
|
|
165
|
+
|
|
166
|
+
X = np.random.rand(sample_count, feature_count)
|
|
167
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
168
|
+
|
|
169
|
+
with pytest.raises(NotFittedError):
|
|
170
|
+
model.predict(X_c)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@pytest.mark.skip(reason="Forced to use original sklearn for now.")
|
|
174
|
+
def test_sklearnex_multivariate_ridge_coefs():
|
|
175
|
+
from sklearnex.linear_model import Ridge
|
|
176
|
+
|
|
177
|
+
_test_multivariate_ridge_coefficients(Ridge, random_state=0)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@pytest.mark.skip(reason="Forced to use original sklearn for now.")
|
|
181
|
+
def test_sklearnex_multivariate_ridge_alpha_shape():
|
|
182
|
+
from sklearnex.linear_model import Ridge
|
|
183
|
+
|
|
184
|
+
_test_multivariate_ridge_alpha_shape(Ridge, random_state=0)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@pytest.mark.skipif(
|
|
188
|
+
not daal_check_version((2025, "P", 100)), reason="requires onedal 2025.1.0 or higher"
|
|
189
|
+
)
|
|
190
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
191
|
+
@pytest.mark.parametrize("overdetermined", [True, False])
|
|
192
|
+
@pytest.mark.parametrize("alpha", [0.00001, 0.1, 1.0])
|
|
193
|
+
@pytest.mark.parametrize("fit_intercept", [True, False])
|
|
194
|
+
def test_ridge_overdetermined_system(
|
|
195
|
+
dataframe, queue, overdetermined, alpha, fit_intercept
|
|
196
|
+
):
|
|
197
|
+
from sklearnex.linear_model import Ridge
|
|
198
|
+
|
|
199
|
+
if overdetermined:
|
|
200
|
+
X = np.random.rand(100, 10)
|
|
201
|
+
y = np.random.rand(100)
|
|
202
|
+
else:
|
|
203
|
+
X = np.random.rand(10, 100)
|
|
204
|
+
y = np.random.rand(10)
|
|
205
|
+
|
|
206
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
207
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
208
|
+
ridge_reg = Ridge(alpha=alpha, fit_intercept=fit_intercept).fit(X_c, y_c)
|
|
209
|
+
|
|
210
|
+
coefficients_manual, intercept_manual = _compute_ridge_coefficients(
|
|
211
|
+
X, y, alpha, fit_intercept=fit_intercept
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
assert_allclose(ridge_reg.coef_, coefficients_manual, rtol=1e-6, atol=1e-6)
|
|
215
|
+
assert_allclose(ridge_reg.intercept_, intercept_manual, rtol=1e-6, atol=1e-6)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
219
|
+
@pytest.mark.parametrize("fit_intercept", [True, False])
|
|
220
|
+
@pytest.mark.parametrize("alpha", [0.1, 0.5, 1.0])
|
|
221
|
+
def test_multivariate_ridge_scalar_alpha(dataframe, queue, fit_intercept, alpha):
|
|
222
|
+
from sklearn.datasets import make_regression
|
|
223
|
+
|
|
224
|
+
from sklearnex.linear_model import Ridge
|
|
225
|
+
|
|
226
|
+
X, y = make_regression(n_samples=10, n_features=3, n_targets=3, random_state=0)
|
|
227
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
228
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
229
|
+
ridge = Ridge(alpha=alpha, fit_intercept=fit_intercept)
|
|
230
|
+
ridge.fit(X_c, y_c)
|
|
231
|
+
|
|
232
|
+
coef_manual, intercept = _compute_ridge_coefficients(X, y, alpha, fit_intercept)
|
|
233
|
+
assert_allclose(ridge.coef_, coef_manual, rtol=1e-6, atol=1e-6)
|
|
234
|
+
assert_allclose(ridge.intercept_, intercept, rtol=1e-6, atol=1e-6)
|
|
235
|
+
|
|
236
|
+
predictions = _as_numpy(ridge.predict(X_c))
|
|
237
|
+
predictions_manual = X @ coef_manual.T + intercept
|
|
238
|
+
assert_allclose(predictions, predictions_manual, rtol=1e-6, atol=1e-6)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
242
|
+
def test_underdetermined_positive_alpha_ridge(dataframe, queue):
|
|
243
|
+
from sklearn.datasets import make_regression
|
|
244
|
+
|
|
245
|
+
from sklearnex.linear_model import Ridge
|
|
246
|
+
|
|
247
|
+
X, y = make_regression(n_samples=5, n_features=6, n_targets=1, random_state=0)
|
|
248
|
+
alpha = 1.0
|
|
249
|
+
X_c = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
250
|
+
y_c = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
251
|
+
ridge = Ridge(alpha=alpha, fit_intercept=True).fit(X_c, y_c)
|
|
252
|
+
|
|
253
|
+
coef_manual, intercept = _compute_ridge_coefficients(X, y, alpha, fit_intercept=True)
|
|
254
|
+
|
|
255
|
+
assert_allclose(ridge.coef_, coef_manual, rtol=1e-6, atol=1e-6)
|
|
256
|
+
assert_allclose(ridge.intercept_, intercept, rtol=1e-6, atol=1e-6)
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
from .t_sne import TSNE
|
|
18
|
+
|
|
19
|
+
__all__ = ["TSNE"]
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
18
|
+
from daal4py.sklearn.manifold import TSNE
|
|
19
|
+
from onedal._device_offload import support_input_format
|
|
20
|
+
|
|
21
|
+
from ..base import oneDALEstimator
|
|
22
|
+
|
|
23
|
+
TSNE.fit = support_input_format(TSNE.fit)
|
|
24
|
+
TSNE.fit_transform = support_input_format(TSNE.fit_transform)
|
|
25
|
+
|
|
26
|
+
if sklearn_check_version("1.4"):
|
|
27
|
+
TSNE._doc_link_module = "daal4py"
|
|
28
|
+
TSNE._doc_link_url_param_generator = oneDALEstimator._doc_link_url_param_generator
|
scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# ===============================================================================
|
|
2
|
+
# Copyright 2021 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ===============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pytest
|
|
19
|
+
from numpy.testing import assert_allclose
|
|
20
|
+
from sklearn.metrics.pairwise import pairwise_distances
|
|
21
|
+
|
|
22
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
23
|
+
|
|
24
|
+
# Note: n_components must be 2 for now
|
|
25
|
+
from onedal.tests.utils._dataframes_support import (
|
|
26
|
+
_as_numpy,
|
|
27
|
+
_convert_to_dataframe,
|
|
28
|
+
get_dataframes_and_queues,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
33
|
+
def test_sklearnex_import(dataframe, queue):
|
|
34
|
+
"""Test TSNE compatibility with different backends and queues, and validate sklearnex module."""
|
|
35
|
+
from sklearnex.manifold import TSNE
|
|
36
|
+
|
|
37
|
+
X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
|
|
38
|
+
X_df = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
39
|
+
tsne = TSNE(n_components=2, perplexity=2.0, random_state=42, init="pca").fit(X_df)
|
|
40
|
+
embedding = tsne.fit_transform(X_df)
|
|
41
|
+
embedding = _as_numpy(embedding)
|
|
42
|
+
assert "daal4py" in tsne.__module__
|
|
43
|
+
assert tsne.n_components == 2
|
|
44
|
+
assert tsne.perplexity == 2.0
|
|
45
|
+
assert tsne.random_state == 42
|
|
46
|
+
assert tsne.init == "pca"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@pytest.mark.parametrize(
|
|
50
|
+
"X_generator,n_components,perplexity,expected_shape,should_raise",
|
|
51
|
+
[
|
|
52
|
+
pytest.param(
|
|
53
|
+
lambda rng: np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]]),
|
|
54
|
+
2,
|
|
55
|
+
2.0,
|
|
56
|
+
(4, 2),
|
|
57
|
+
False,
|
|
58
|
+
id="Basic functionality",
|
|
59
|
+
),
|
|
60
|
+
pytest.param(
|
|
61
|
+
lambda rng: rng.random((100, 10)),
|
|
62
|
+
2,
|
|
63
|
+
30.0,
|
|
64
|
+
(100, 2),
|
|
65
|
+
False,
|
|
66
|
+
id="Random data",
|
|
67
|
+
),
|
|
68
|
+
pytest.param(
|
|
69
|
+
lambda rng: np.array([[0, 0], [1, 1], [2, 2]]),
|
|
70
|
+
2,
|
|
71
|
+
2.0,
|
|
72
|
+
(3, 2),
|
|
73
|
+
False,
|
|
74
|
+
id="Valid minimal data",
|
|
75
|
+
),
|
|
76
|
+
pytest.param(
|
|
77
|
+
lambda rng: np.empty((0, 10)),
|
|
78
|
+
2,
|
|
79
|
+
5.0,
|
|
80
|
+
None,
|
|
81
|
+
True,
|
|
82
|
+
id="Empty data",
|
|
83
|
+
),
|
|
84
|
+
pytest.param(
|
|
85
|
+
lambda rng: np.array([[0, 0], [1, np.nan], [2, np.inf]]),
|
|
86
|
+
2,
|
|
87
|
+
5.0,
|
|
88
|
+
None,
|
|
89
|
+
True,
|
|
90
|
+
id="Data with NaN/Inf",
|
|
91
|
+
),
|
|
92
|
+
pytest.param(
|
|
93
|
+
lambda rng: rng.random((50, 500)) * (rng.random((50, 500)) > 0.99),
|
|
94
|
+
2,
|
|
95
|
+
30.0,
|
|
96
|
+
(50, 2),
|
|
97
|
+
False,
|
|
98
|
+
id="Sparse-like high-dimensional data",
|
|
99
|
+
),
|
|
100
|
+
pytest.param(
|
|
101
|
+
lambda rng: np.hstack(
|
|
102
|
+
[
|
|
103
|
+
np.ones((50, 1)), # First column is 1
|
|
104
|
+
rng.random((50, 499)) * (rng.random((50, 499)) > 0.99),
|
|
105
|
+
]
|
|
106
|
+
),
|
|
107
|
+
2,
|
|
108
|
+
30.0,
|
|
109
|
+
(50, 2),
|
|
110
|
+
False,
|
|
111
|
+
id="Sparse-like data with constant column",
|
|
112
|
+
),
|
|
113
|
+
pytest.param(
|
|
114
|
+
lambda rng: np.where(
|
|
115
|
+
np.arange(50 * 500).reshape(50, 500) % 10 == 0, 0, rng.random((50, 500))
|
|
116
|
+
),
|
|
117
|
+
2,
|
|
118
|
+
30.0,
|
|
119
|
+
(50, 2),
|
|
120
|
+
False,
|
|
121
|
+
id="Sparse-like data with every tenth element zero",
|
|
122
|
+
),
|
|
123
|
+
pytest.param(
|
|
124
|
+
lambda rng: rng.random((10, 5)),
|
|
125
|
+
2,
|
|
126
|
+
0.5,
|
|
127
|
+
(10, 2),
|
|
128
|
+
False,
|
|
129
|
+
id="Extremely low perplexity",
|
|
130
|
+
),
|
|
131
|
+
],
|
|
132
|
+
)
|
|
133
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
134
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
135
|
+
def test_tsne_functionality_and_edge_cases(
|
|
136
|
+
X_generator,
|
|
137
|
+
n_components,
|
|
138
|
+
perplexity,
|
|
139
|
+
expected_shape,
|
|
140
|
+
should_raise,
|
|
141
|
+
dataframe,
|
|
142
|
+
queue,
|
|
143
|
+
dtype,
|
|
144
|
+
):
|
|
145
|
+
from sklearnex.manifold import TSNE
|
|
146
|
+
|
|
147
|
+
rng = np.random.default_rng(
|
|
148
|
+
seed=42
|
|
149
|
+
) # Use generator to ensure independent dataset per test
|
|
150
|
+
X = X_generator(rng)
|
|
151
|
+
X = X.astype(dtype) if X.size > 0 else X
|
|
152
|
+
X_df = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
153
|
+
|
|
154
|
+
if should_raise:
|
|
155
|
+
with pytest.raises(ValueError):
|
|
156
|
+
TSNE(n_components=n_components, perplexity=perplexity).fit_transform(X_df)
|
|
157
|
+
else:
|
|
158
|
+
tsne = TSNE(n_components=n_components, perplexity=perplexity, random_state=42)
|
|
159
|
+
embedding = tsne.fit_transform(X_df)
|
|
160
|
+
embedding = _as_numpy(embedding)
|
|
161
|
+
assert embedding.shape == expected_shape
|
|
162
|
+
assert np.all(np.isfinite(embedding))
|
|
163
|
+
assert np.any(embedding != 0)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# Note: since sklearn1.2, the PCA initialization divides by standard deviations of components.
|
|
167
|
+
# Since those will be zeros for constant data, it will end up producing NaNs, hence it's not tested.
|
|
168
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
169
|
+
@pytest.mark.parametrize(
|
|
170
|
+
"init", ["random"] + (["pca"] if not sklearn_check_version("1.2") else [])
|
|
171
|
+
)
|
|
172
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
173
|
+
def test_tsne_constant_data(init, dataframe, queue, dtype):
|
|
174
|
+
from sklearnex.manifold import TSNE
|
|
175
|
+
|
|
176
|
+
X = np.ones((10, 10), dtype=dtype)
|
|
177
|
+
X_df = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
178
|
+
tsne = TSNE(n_components=2, init=init, perplexity=5, random_state=42)
|
|
179
|
+
embedding = tsne.fit_transform(X_df)
|
|
180
|
+
embedding = _as_numpy(embedding)
|
|
181
|
+
assert embedding.shape == (10, 2)
|
|
182
|
+
if init == "pca":
|
|
183
|
+
assert np.isclose(embedding[:, 0].std(), 0, atol=1e-6) # Constant first dimension
|
|
184
|
+
assert np.allclose(embedding[:, 1], 0, atol=1e-6) # Zero second dimension
|
|
185
|
+
elif init == "random":
|
|
186
|
+
assert np.all(np.isfinite(embedding))
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
190
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
191
|
+
def test_tsne_reproducibility(dataframe, queue, dtype):
|
|
192
|
+
from sklearnex.manifold import TSNE
|
|
193
|
+
|
|
194
|
+
rng = np.random.default_rng(seed=42)
|
|
195
|
+
X = rng.random((50, 10)).astype(dtype)
|
|
196
|
+
X_df = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
197
|
+
tsne_1 = TSNE(n_components=2, random_state=42).fit_transform(X_df)
|
|
198
|
+
tsne_2 = TSNE(n_components=2, random_state=42).fit_transform(X_df)
|
|
199
|
+
# in case of dpctl.tensor.usm_ndarray convert to numpy array
|
|
200
|
+
tsne_1 = _as_numpy(tsne_1)
|
|
201
|
+
tsne_2 = _as_numpy(tsne_2)
|
|
202
|
+
assert_allclose(tsne_1, tsne_2, rtol=1e-5)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
206
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
207
|
+
def test_tsne_complex_and_gpu_validation(dataframe, queue, dtype):
|
|
208
|
+
from sklearnex.manifold import TSNE
|
|
209
|
+
|
|
210
|
+
X = np.array(
|
|
211
|
+
[
|
|
212
|
+
[1, 1, 1, 1],
|
|
213
|
+
[1.1, 1.1, 1.1, 1.1],
|
|
214
|
+
[0.9, 0.9, 0.9, 0.9],
|
|
215
|
+
[2e9, 2e-9, -2e9, -2e-9],
|
|
216
|
+
[5e-5, 5e5, -5e-5, -5e5],
|
|
217
|
+
[9e-7, -9e7, 9e-7, -9e7],
|
|
218
|
+
[1, -1, 1, -1],
|
|
219
|
+
[-1e-9, 1e-9, -1e-9, 1e-9],
|
|
220
|
+
[42, 42, 42, 42],
|
|
221
|
+
[8, -8, 8e8, -8e-8],
|
|
222
|
+
[1e-3, 1e3, -1e3, -1e-3],
|
|
223
|
+
[0, 1e9, -1e-9, 1],
|
|
224
|
+
[0, 0, 1, -1],
|
|
225
|
+
[0, 0, 0, 0],
|
|
226
|
+
[-1e5, 0, 1e5, -1],
|
|
227
|
+
[1, 0, -1e8, 1e8],
|
|
228
|
+
]
|
|
229
|
+
)
|
|
230
|
+
n_components = 2
|
|
231
|
+
perplexity = 3.0
|
|
232
|
+
expected_shape = (16, 2)
|
|
233
|
+
|
|
234
|
+
X = X.astype(dtype)
|
|
235
|
+
X_df = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
236
|
+
tsne = TSNE(n_components=n_components, perplexity=perplexity, random_state=42)
|
|
237
|
+
embedding = tsne.fit_transform(X_df)
|
|
238
|
+
|
|
239
|
+
# Validate results
|
|
240
|
+
assert embedding.shape == expected_shape
|
|
241
|
+
embedding = _as_numpy(embedding)
|
|
242
|
+
assert np.all(np.isfinite(embedding))
|
|
243
|
+
assert np.any(embedding != 0)
|
|
244
|
+
|
|
245
|
+
# Ensure close points in original space remain close in embedding
|
|
246
|
+
group_a_indices = [0, 1, 2] # Hardcoded index of similar points
|
|
247
|
+
group_b_indices = [3, 4, 5] # Hardcoded index of dissimilar points from a
|
|
248
|
+
embedding_distances = pairwise_distances(
|
|
249
|
+
X, metric="euclidean"
|
|
250
|
+
) # Get an array of distance where [i, j] is distance b/t i and j
|
|
251
|
+
# Check for distance b/t two points in group A < distance of this point and any point in group B
|
|
252
|
+
for i in group_a_indices:
|
|
253
|
+
for j in group_a_indices:
|
|
254
|
+
assert (
|
|
255
|
+
embedding_distances[i, j] < embedding_distances[i, group_b_indices].min()
|
|
256
|
+
), f"Point {i} in Group A is closer to a point in Group B than to another point in Group A."
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
from .pairwise import pairwise_distances
|
|
18
|
+
from .ranking import roc_auc_score
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"roc_auc_score",
|
|
22
|
+
"pairwise_distances",
|
|
23
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
from daal4py.sklearn.metrics import pairwise_distances
|
|
18
|
+
from onedal._device_offload import support_input_format
|
|
19
|
+
|
|
20
|
+
pairwise_distances = support_input_format(pairwise_distances)
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
from daal4py.sklearn.metrics import roc_auc_score
|
|
18
|
+
from onedal._device_offload import support_input_format
|
|
19
|
+
|
|
20
|
+
roc_auc_score = support_input_format(roc_auc_score)
|
scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ===============================================================================
|
|
2
|
+
# Copyright 2021 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ===============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
from numpy.testing import assert_allclose
|
|
19
|
+
from sklearn.datasets import load_breast_cancer
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_sklearnex_import_roc_auc():
|
|
23
|
+
from sklearnex.linear_model import LogisticRegression
|
|
24
|
+
from sklearnex.metrics import roc_auc_score
|
|
25
|
+
|
|
26
|
+
X, y = load_breast_cancer(return_X_y=True)
|
|
27
|
+
clf = LogisticRegression(solver="liblinear", random_state=0).fit(X, y)
|
|
28
|
+
res = roc_auc_score(y, clf.decision_function(X))
|
|
29
|
+
assert_allclose(res, 0.99, atol=1e-2)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_sklearnex_import_pairwise_distances():
|
|
33
|
+
from sklearnex.metrics import pairwise_distances
|
|
34
|
+
|
|
35
|
+
rng = np.random.RandomState(0)
|
|
36
|
+
x = np.abs(rng.rand(4), dtype=np.float64)
|
|
37
|
+
x = np.vstack([x, x])
|
|
38
|
+
res = pairwise_distances(x, metric="cosine")
|
|
39
|
+
assert_allclose(res, [[0.0, 0.0], [0.0, 0.0]], atol=1e-2)
|
scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
from .split import train_test_split
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"train_test_split",
|
|
21
|
+
]
|