scikit-learn-intelex 2024.1.0__py310-none-win_amd64.whl → 2025.1.0__py310-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.
Potentially problematic release.
This version of scikit-learn-intelex might be problematic. Click here for more details.
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/_daal4py.cp310-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/doc/third-party-programs.txt +424 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mb/model_builders.py +377 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp310-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +248 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +597 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition}/__init__.py +3 -3
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +524 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +196 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +337 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1397 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn}/linear_model/__init__.py +29 -29
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +848 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +272 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +325 -0
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +2 -2
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +1026 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +208 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/manifold}/__init__.py +4 -2
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +405 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +236 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/_models_info.py +13 -22
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/test_patching.py +10 -42
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch}/tests/utils/_launch_algorithms.py +4 -5
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +503 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +139 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +74 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +734 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +75 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +693 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/__init__.py +83 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_config.py +54 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_device_offload.py +222 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp310-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp310-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +107 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +160 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +298 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +196 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +110 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +564 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +115 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_base.py +38 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_policy.py +59 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/_spmd_policy.py +30 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +125 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/common/tests/test_policy.py +76 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance}/__init__.py +3 -2
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +125 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +146 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +122 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +154 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +126 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +414 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition}/__init__.py +3 -2
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +204 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +186 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +198 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +727 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +258 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +329 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +249 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +168 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +107 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +250 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +767 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +25 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +153 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/svm.py +556 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +351 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +176 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/test_common.py +57 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +162 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +102 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/__init__.py +49 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +81 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/_dpep_helpers.py +56 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/onedal/utils/validation.py +440 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__init__.py +10 -7
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_config.py +22 -16
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +126 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/_utils.py +27 -4
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +230 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +345 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +270 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +404 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/__init__.py +1 -1
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/dbscan.py +19 -10
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +395 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +8 -6
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +159 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +398 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +237 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +425 -0
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_preview_pca.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +25 -9
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/dispatcher.py +241 -60
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/_forest.py +250 -188
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +39 -21
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/dispatcher.py +16 -2
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +13 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +482 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +425 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +341 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex}/linear_model/logistic_regression.py +194 -133
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/linear_model/ridge.py +7 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +207 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +153 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +134 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/t_sne.py +4 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/pairwise.py +5 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/ranking.py +3 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/split.py +5 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/__init__.py +1 -1
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +236 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/common.py +53 -6
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +51 -155
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +46 -149
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +55 -100
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +16 -18
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview}/__init__.py +1 -3
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +138 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +18 -5
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +233 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +266 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model}/__init__.py +19 -19
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/ridge.py +424 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_ridge.py +102 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/__init__.py +1 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +107 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +307 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +97 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +172 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +21 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +37 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +107 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +184 -0
- {scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition}/__init__.py +3 -2
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +11 -12
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +269 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +128 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +4 -12
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +265 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +3 -1
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py → scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +14 -18
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +329 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +145 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +162 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +288 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +339 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvc.py +172 -78
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/nusvr.py +74 -70
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svc.py +170 -77
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/svr.py +66 -66
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +12 -20
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +390 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +123 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +379 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +276 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +108 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/tests/test_parallel.py +6 -8
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +385 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +321 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +44 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +371 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +82 -0
- scikit_learn_intelex-2025.1.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_finite.py +89 -0
- {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/METADATA +231 -230
- scikit_learn_intelex-2025.1.0.dist-info/RECORD +257 -0
- {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/WHEEL +1 -1
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +0 -223
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +0 -17
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +0 -30
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +0 -17
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +0 -27
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +0 -388
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_path.py +0 -17
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +0 -82
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +0 -28
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/neighbors/lof.py +0 -436
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster/_common.py +0 -84
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/cluster/k_means.py +0 -376
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +0 -98
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/pca.py +0 -376
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/preview/linear_model/tests/test_preview_logistic_regression.py +0 -59
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +0 -188
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +0 -225
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +0 -227
- scikit_learn_intelex-2024.1.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability_tests.py +0 -428
- scikit_learn_intelex-2024.1.0.dist-info/RECORD +0 -97
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/__main__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/decomposition/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/ensemble/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/glob/__main__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/spmd/neighbors/neighbors.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/svm/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/__init__.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/parallel.py +0 -0
- {scikit_learn_intelex-2024.1.0.data → scikit_learn_intelex-2025.1.0.data}/data/Lib/site-packages/sklearnex/utils/validation.py +0 -0
- {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/LICENSE.txt +0 -0
- {scikit_learn_intelex-2024.1.0.dist-info → scikit_learn_intelex-2025.1.0.dist-info}/top_level.txt +0 -0
|
@@ -25,9 +25,19 @@ from onedal.tests.utils._dataframes_support import (
|
|
|
25
25
|
get_dataframes_and_queues,
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
+
hparam_values = [
|
|
29
|
+
(None, None, None, None),
|
|
30
|
+
(8, 100, 32, 0.3),
|
|
31
|
+
(16, 100, 32, 0.3),
|
|
32
|
+
(32, 100, 32, 0.3),
|
|
33
|
+
(64, 10, 32, 0.1),
|
|
34
|
+
(128, 100, 1000, 1.0),
|
|
35
|
+
]
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
|
|
38
|
+
@pytest.mark.parametrize("dataframe, queue", get_dataframes_and_queues())
|
|
39
|
+
@pytest.mark.parametrize("block, trees, rows, scale", hparam_values)
|
|
40
|
+
def test_sklearnex_import_rf_classifier(dataframe, queue, block, trees, rows, scale):
|
|
31
41
|
from sklearnex.ensemble import RandomForestClassifier
|
|
32
42
|
|
|
33
43
|
X, y = make_classification(
|
|
@@ -41,16 +51,20 @@ def test_sklearnex_import_rf_classifier(dataframe, queue):
|
|
|
41
51
|
X = _convert_to_dataframe(X, sycl_queue=queue, target_df=dataframe)
|
|
42
52
|
y = _convert_to_dataframe(y, sycl_queue=queue, target_df=dataframe)
|
|
43
53
|
rf = RandomForestClassifier(max_depth=2, random_state=0).fit(X, y)
|
|
54
|
+
hparams = rf.get_hyperparameters("infer")
|
|
55
|
+
if hparams and block is not None:
|
|
56
|
+
hparams.block_size = block
|
|
57
|
+
hparams.min_trees_for_threading = trees
|
|
58
|
+
hparams.min_number_of_rows_for_vect_seq_compute = rows
|
|
59
|
+
hparams.scale_factor_for_vect_parallel_compute = scale
|
|
44
60
|
assert "sklearnex" in rf.__module__
|
|
45
61
|
assert_allclose([1], _as_numpy(rf.predict([[0, 0, 0, 0]])))
|
|
46
62
|
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
# investigate failure for `dpnp.ndarrays` and `dpctl.tensors` on `GPU`
|
|
50
|
-
@pytest.mark.parametrize(
|
|
51
|
-
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
52
|
-
)
|
|
64
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
53
65
|
def test_sklearnex_import_rf_regression(dataframe, queue):
|
|
66
|
+
if queue and queue.sycl_device.is_gpu:
|
|
67
|
+
pytest.skip("RF regressor predict for the GPU sycl_queue is buggy.")
|
|
54
68
|
from sklearnex.ensemble import RandomForestRegressor
|
|
55
69
|
|
|
56
70
|
X, y = make_regression(n_features=4, n_informative=2, random_state=0, shuffle=False)
|
|
@@ -59,18 +73,20 @@ def test_sklearnex_import_rf_regression(dataframe, queue):
|
|
|
59
73
|
rf = RandomForestRegressor(max_depth=2, random_state=0).fit(X, y)
|
|
60
74
|
assert "sklearnex" in rf.__module__
|
|
61
75
|
pred = _as_numpy(rf.predict([[0, 0, 0, 0]]))
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
|
|
77
|
+
if queue is not None and queue.sycl_device.is_gpu:
|
|
78
|
+
assert_allclose([-0.011208], pred, atol=1e-2)
|
|
64
79
|
else:
|
|
65
|
-
|
|
80
|
+
if daal_check_version((2024, "P", 0)):
|
|
81
|
+
assert_allclose([-6.971], pred, atol=1e-2)
|
|
82
|
+
else:
|
|
83
|
+
assert_allclose([-6.839], pred, atol=1e-2)
|
|
66
84
|
|
|
67
85
|
|
|
68
|
-
|
|
69
|
-
# investigate failure for `dpnp.ndarrays` and `dpctl.tensors` on `GPU`
|
|
70
|
-
@pytest.mark.parametrize(
|
|
71
|
-
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
72
|
-
)
|
|
86
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
73
87
|
def test_sklearnex_import_et_classifier(dataframe, queue):
|
|
88
|
+
if queue and queue.sycl_device.is_gpu:
|
|
89
|
+
pytest.skip("ET classifier predict for the GPU sycl_queue is buggy.")
|
|
74
90
|
from sklearnex.ensemble import ExtraTreesClassifier
|
|
75
91
|
|
|
76
92
|
X, y = make_classification(
|
|
@@ -90,12 +106,10 @@ def test_sklearnex_import_et_classifier(dataframe, queue):
|
|
|
90
106
|
assert_allclose([1], _as_numpy(rf.predict([[0, 0, 0, 0]])))
|
|
91
107
|
|
|
92
108
|
|
|
93
|
-
|
|
94
|
-
# investigate failure for `dpnp.ndarrays` and `dpctl.tensors` on `GPU`
|
|
95
|
-
@pytest.mark.parametrize(
|
|
96
|
-
"dataframe,queue", get_dataframes_and_queues(device_filter_="cpu")
|
|
97
|
-
)
|
|
109
|
+
@pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues())
|
|
98
110
|
def test_sklearnex_import_et_regression(dataframe, queue):
|
|
111
|
+
if queue and queue.sycl_device.is_gpu:
|
|
112
|
+
pytest.skip("ET regressor predict for the GPU sycl_queue is buggy.")
|
|
99
113
|
from sklearnex.ensemble import ExtraTreesRegressor
|
|
100
114
|
|
|
101
115
|
X, y = make_regression(n_features=1, random_state=0, shuffle=False)
|
|
@@ -114,4 +128,8 @@ def test_sklearnex_import_et_regression(dataframe, queue):
|
|
|
114
128
|
]
|
|
115
129
|
)
|
|
116
130
|
)
|
|
117
|
-
|
|
131
|
+
|
|
132
|
+
if queue is not None and queue.sycl_device.is_gpu:
|
|
133
|
+
assert_allclose([1.909769], pred, atol=1e-2)
|
|
134
|
+
else:
|
|
135
|
+
assert_allclose([0.445], pred, atol=1e-2)
|
|
@@ -17,18 +17,32 @@
|
|
|
17
17
|
|
|
18
18
|
def get_patch_str(name=None, verbose=True):
|
|
19
19
|
return f"""try:
|
|
20
|
+
# TEMP. FIX: sklearnex.patch_sklearn imports sklearn beforehand
|
|
21
|
+
# when it didn't initialized _threadpool_controller required for
|
|
22
|
+
# pairwise distances dispatching during imports.
|
|
23
|
+
# Manually setting and deleting _threadpool_controller during patch fixes it.
|
|
24
|
+
import sklearn
|
|
25
|
+
from threadpoolctl import ThreadpoolController
|
|
26
|
+
sklearn._threadpool_controller = ThreadpoolController()
|
|
20
27
|
from sklearnex import patch_sklearn
|
|
21
28
|
patch_sklearn(name={str(name)}, verbose={str(verbose)})
|
|
22
|
-
del patch_sklearn
|
|
29
|
+
del patch_sklearn, sklearn._threadpool_controller
|
|
23
30
|
except ImportError:
|
|
24
31
|
pass"""
|
|
25
32
|
|
|
26
33
|
|
|
27
34
|
def get_patch_str_re():
|
|
28
35
|
return r"""\ntry:
|
|
36
|
+
\# TEMP. FIX: sklearnex.patch_sklearn imports sklearn beforehand
|
|
37
|
+
\# when it didn't initialized _threadpool_controller required for
|
|
38
|
+
\# pairwise distances dispatching during imports.
|
|
39
|
+
\# Manually setting and deleting _threadpool_controller during patch fixes it.
|
|
40
|
+
import sklearn
|
|
41
|
+
from threadpoolctl import ThreadpoolController
|
|
42
|
+
sklearn._threadpool_controller = ThreadpoolController\(\)
|
|
29
43
|
from sklearnex import patch_sklearn
|
|
30
44
|
patch_sklearn\(name=.*, verbose=.*\)
|
|
31
|
-
del patch_sklearn
|
|
45
|
+
del patch_sklearn, sklearn._threadpool_controller
|
|
32
46
|
except ImportError:
|
|
33
47
|
pass\n"""
|
|
34
48
|
|
|
@@ -0,0 +1,32 @@
|
|
|
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 .coordinate_descent import ElasticNet, Lasso
|
|
18
|
+
from .incremental_linear import IncrementalLinearRegression
|
|
19
|
+
from .incremental_ridge import IncrementalRidge
|
|
20
|
+
from .linear import LinearRegression
|
|
21
|
+
from .logistic_regression import LogisticRegression
|
|
22
|
+
from .ridge import Ridge
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"ElasticNet",
|
|
26
|
+
"IncrementalLinearRegression",
|
|
27
|
+
"IncrementalRidge",
|
|
28
|
+
"Lasso",
|
|
29
|
+
"LinearRegression",
|
|
30
|
+
"LogisticRegression",
|
|
31
|
+
"Ridge",
|
|
32
|
+
]
|
|
@@ -15,3 +15,16 @@
|
|
|
15
15
|
# ===============================================================================
|
|
16
16
|
|
|
17
17
|
from daal4py.sklearn.linear_model import ElasticNet, Lasso
|
|
18
|
+
from onedal._device_offload import support_input_format
|
|
19
|
+
|
|
20
|
+
# Note: `sklearnex.linear_model.ElasticNet` only has functional
|
|
21
|
+
# sycl GPU support. No GPU device will be offloaded.
|
|
22
|
+
ElasticNet.fit = support_input_format(queue_param=False)(ElasticNet.fit)
|
|
23
|
+
ElasticNet.predict = support_input_format(queue_param=False)(ElasticNet.predict)
|
|
24
|
+
ElasticNet.score = support_input_format(queue_param=False)(ElasticNet.score)
|
|
25
|
+
|
|
26
|
+
# Note: `sklearnex.linear_model.Lasso` only has functional
|
|
27
|
+
# sycl GPU support. No GPU device will be offloaded.
|
|
28
|
+
Lasso.fit = support_input_format(queue_param=False)(Lasso.fit)
|
|
29
|
+
Lasso.predict = support_input_format(queue_param=False)(Lasso.predict)
|
|
30
|
+
Lasso.score = support_input_format(queue_param=False)(Lasso.score)
|
|
@@ -0,0 +1,482 @@
|
|
|
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 numbers
|
|
18
|
+
import warnings
|
|
19
|
+
|
|
20
|
+
import numpy as np
|
|
21
|
+
from sklearn.base import BaseEstimator, MultiOutputMixin, RegressorMixin
|
|
22
|
+
from sklearn.metrics import r2_score
|
|
23
|
+
from sklearn.utils import check_array, gen_batches
|
|
24
|
+
from sklearn.utils.validation import check_is_fitted
|
|
25
|
+
|
|
26
|
+
from daal4py.sklearn._n_jobs_support import control_n_jobs
|
|
27
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
28
|
+
from onedal.linear_model import (
|
|
29
|
+
IncrementalLinearRegression as onedal_IncrementalLinearRegression,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if sklearn_check_version("1.2"):
|
|
33
|
+
from sklearn.utils._param_validation import Interval
|
|
34
|
+
|
|
35
|
+
if sklearn_check_version("1.6"):
|
|
36
|
+
from sklearn.utils.validation import validate_data
|
|
37
|
+
else:
|
|
38
|
+
validate_data = BaseEstimator._validate_data
|
|
39
|
+
|
|
40
|
+
from onedal.common.hyperparameters import get_hyperparameters
|
|
41
|
+
|
|
42
|
+
from .._device_offload import dispatch, wrap_output_data
|
|
43
|
+
from .._utils import IntelEstimator, PatchingConditionsChain, register_hyperparameters
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@register_hyperparameters(
|
|
47
|
+
{
|
|
48
|
+
"fit": get_hyperparameters("linear_regression", "train"),
|
|
49
|
+
"partial_fit": get_hyperparameters("linear_regression", "train"),
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
@control_n_jobs(
|
|
53
|
+
decorated_methods=["fit", "partial_fit", "predict", "score", "_onedal_finalize_fit"]
|
|
54
|
+
)
|
|
55
|
+
class IncrementalLinearRegression(
|
|
56
|
+
IntelEstimator, MultiOutputMixin, RegressorMixin, BaseEstimator
|
|
57
|
+
):
|
|
58
|
+
"""
|
|
59
|
+
Trains a linear regression model, allows for computation if the data are split into
|
|
60
|
+
batches. The user can use the ``partial_fit`` method to provide a single batch of data or use the ``fit`` method to provide
|
|
61
|
+
the entire dataset.
|
|
62
|
+
|
|
63
|
+
Parameters
|
|
64
|
+
----------
|
|
65
|
+
fit_intercept : bool, default=True
|
|
66
|
+
Whether to calculate the intercept for this model. If set
|
|
67
|
+
to False, no intercept will be used in calculations
|
|
68
|
+
(i.e. data is expected to be centered).
|
|
69
|
+
|
|
70
|
+
copy_X : bool, default=True
|
|
71
|
+
If True, X will be copied; else, it may be overwritten.
|
|
72
|
+
|
|
73
|
+
n_jobs : int, default=None
|
|
74
|
+
The number of jobs to use for the computation.
|
|
75
|
+
|
|
76
|
+
batch_size : int, default=None
|
|
77
|
+
The number of samples to use for each batch. Only used when calling
|
|
78
|
+
``fit``. If ``batch_size`` is ``None``, then ``batch_size``
|
|
79
|
+
is inferred from the data and set to ``5 * n_features``.
|
|
80
|
+
|
|
81
|
+
Attributes
|
|
82
|
+
----------
|
|
83
|
+
coef_ : array of shape (n_features, ) or (n_targets, n_features)
|
|
84
|
+
Estimated coefficients for the linear regression problem.
|
|
85
|
+
If multiple targets are passed during the fit (y 2D), this
|
|
86
|
+
is a 2D array of shape (n_targets, n_features), while if only
|
|
87
|
+
one target is passed, this is a 1D array of length n_features.
|
|
88
|
+
|
|
89
|
+
intercept_ : float or array of shape (n_targets,)
|
|
90
|
+
Independent term in the linear model. Set to 0.0 if
|
|
91
|
+
`fit_intercept = False`.
|
|
92
|
+
|
|
93
|
+
n_samples_seen_ : int
|
|
94
|
+
The number of samples processed by the estimator. Will be reset on
|
|
95
|
+
new calls to ``fit``, but increments across ``partial_fit`` calls.
|
|
96
|
+
It should be not less than `n_features_in_` if `fit_intercept`
|
|
97
|
+
is False and not less than `n_features_in_` + 1 if `fit_intercept`
|
|
98
|
+
is True to obtain regression coefficients.
|
|
99
|
+
|
|
100
|
+
batch_size_ : int
|
|
101
|
+
Inferred batch size from ``batch_size``.
|
|
102
|
+
|
|
103
|
+
n_features_in_ : int
|
|
104
|
+
Number of features seen during ``fit`` or ``partial_fit``.
|
|
105
|
+
|
|
106
|
+
Examples
|
|
107
|
+
--------
|
|
108
|
+
>>> import numpy as np
|
|
109
|
+
>>> from sklearnex.linear_model import IncrementalLinearRegression
|
|
110
|
+
>>> inclr = IncrementalLinearRegression(batch_size=2)
|
|
111
|
+
>>> X = np.array([[1, 2], [3, 4], [5, 6], [7, 10]])
|
|
112
|
+
>>> y = np.array([1.5, 3.5, 5.5, 8.5])
|
|
113
|
+
>>> inclr.partial_fit(X[:2], y[:2])
|
|
114
|
+
>>> inclr.partial_fit(X[2:], y[2:])
|
|
115
|
+
>>> inclr.coef_
|
|
116
|
+
np.array([0.5., 0.5.])
|
|
117
|
+
>>> inclr.intercept_
|
|
118
|
+
np.array(0.)
|
|
119
|
+
>>> inclr.fit(X)
|
|
120
|
+
>>> inclr.coef_
|
|
121
|
+
np.array([0.5., 0.5.])
|
|
122
|
+
>>> inclr.intercept_
|
|
123
|
+
np.array(0.)
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
_onedal_incremental_linear = staticmethod(onedal_IncrementalLinearRegression)
|
|
127
|
+
|
|
128
|
+
if sklearn_check_version("1.2"):
|
|
129
|
+
_parameter_constraints: dict = {
|
|
130
|
+
"fit_intercept": ["boolean"],
|
|
131
|
+
"copy_X": ["boolean"],
|
|
132
|
+
"n_jobs": [Interval(numbers.Integral, -1, None, closed="left"), None],
|
|
133
|
+
"batch_size": [Interval(numbers.Integral, 1, None, closed="left"), None],
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
def __init__(self, *, fit_intercept=True, copy_X=True, n_jobs=None, batch_size=None):
|
|
137
|
+
self.fit_intercept = fit_intercept
|
|
138
|
+
self.copy_X = copy_X
|
|
139
|
+
self.n_jobs = n_jobs
|
|
140
|
+
self.batch_size = batch_size
|
|
141
|
+
|
|
142
|
+
def _onedal_supported(self, method_name, *data):
|
|
143
|
+
patching_status = PatchingConditionsChain(
|
|
144
|
+
f"sklearn.linear_model.{self.__class__.__name__}.{method_name}"
|
|
145
|
+
)
|
|
146
|
+
return patching_status
|
|
147
|
+
|
|
148
|
+
_onedal_cpu_supported = _onedal_supported
|
|
149
|
+
_onedal_gpu_supported = _onedal_supported
|
|
150
|
+
|
|
151
|
+
def _onedal_predict(self, X, queue=None):
|
|
152
|
+
if sklearn_check_version("1.2"):
|
|
153
|
+
self._validate_params()
|
|
154
|
+
|
|
155
|
+
if sklearn_check_version("1.0"):
|
|
156
|
+
X = validate_data(
|
|
157
|
+
self,
|
|
158
|
+
X,
|
|
159
|
+
dtype=[np.float64, np.float32],
|
|
160
|
+
copy=self.copy_X,
|
|
161
|
+
reset=False,
|
|
162
|
+
)
|
|
163
|
+
else:
|
|
164
|
+
X = check_array(
|
|
165
|
+
X,
|
|
166
|
+
dtype=[np.float64, np.float32],
|
|
167
|
+
copy=self.copy_X,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
assert hasattr(self, "_onedal_estimator")
|
|
171
|
+
if self._need_to_finalize:
|
|
172
|
+
self._onedal_finalize_fit()
|
|
173
|
+
return self._onedal_estimator.predict(X, queue=queue)
|
|
174
|
+
|
|
175
|
+
def _onedal_score(self, X, y, sample_weight=None, queue=None):
|
|
176
|
+
return r2_score(
|
|
177
|
+
y, self._onedal_predict(X, queue=queue), sample_weight=sample_weight
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
def _onedal_partial_fit(self, X, y, check_input=True, queue=None):
|
|
181
|
+
first_pass = not hasattr(self, "n_samples_seen_") or self.n_samples_seen_ == 0
|
|
182
|
+
|
|
183
|
+
if sklearn_check_version("1.2"):
|
|
184
|
+
self._validate_params()
|
|
185
|
+
|
|
186
|
+
if check_input:
|
|
187
|
+
if sklearn_check_version("1.0"):
|
|
188
|
+
X, y = validate_data(
|
|
189
|
+
self,
|
|
190
|
+
X,
|
|
191
|
+
y,
|
|
192
|
+
dtype=[np.float64, np.float32],
|
|
193
|
+
reset=first_pass,
|
|
194
|
+
copy=self.copy_X,
|
|
195
|
+
multi_output=True,
|
|
196
|
+
force_all_finite=False,
|
|
197
|
+
)
|
|
198
|
+
else:
|
|
199
|
+
X = check_array(
|
|
200
|
+
X,
|
|
201
|
+
dtype=[np.float64, np.float32],
|
|
202
|
+
copy=self.copy_X,
|
|
203
|
+
force_all_finite=False,
|
|
204
|
+
)
|
|
205
|
+
y = check_array(
|
|
206
|
+
y,
|
|
207
|
+
dtype=[np.float64, np.float32],
|
|
208
|
+
copy=False,
|
|
209
|
+
ensure_2d=False,
|
|
210
|
+
force_all_finite=False,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
if first_pass:
|
|
214
|
+
self.n_samples_seen_ = X.shape[0]
|
|
215
|
+
self.n_features_in_ = X.shape[1]
|
|
216
|
+
else:
|
|
217
|
+
self.n_samples_seen_ += X.shape[0]
|
|
218
|
+
onedal_params = {"fit_intercept": self.fit_intercept, "copy_X": self.copy_X}
|
|
219
|
+
if not hasattr(self, "_onedal_estimator"):
|
|
220
|
+
self._onedal_estimator = self._onedal_incremental_linear(**onedal_params)
|
|
221
|
+
self._onedal_estimator.partial_fit(X, y, queue=queue)
|
|
222
|
+
self._need_to_finalize = True
|
|
223
|
+
|
|
224
|
+
def _onedal_finalize_fit(self, queue=None):
|
|
225
|
+
assert hasattr(self, "_onedal_estimator")
|
|
226
|
+
is_underdetermined = self.n_samples_seen_ < self.n_features_in_ + int(
|
|
227
|
+
self.fit_intercept
|
|
228
|
+
)
|
|
229
|
+
if is_underdetermined:
|
|
230
|
+
raise ValueError("Not enough samples to finalize")
|
|
231
|
+
self._onedal_estimator.finalize_fit(queue=queue)
|
|
232
|
+
self._need_to_finalize = False
|
|
233
|
+
|
|
234
|
+
def _onedal_fit(self, X, y, queue=None):
|
|
235
|
+
if sklearn_check_version("1.2"):
|
|
236
|
+
self._validate_params()
|
|
237
|
+
|
|
238
|
+
if sklearn_check_version("1.0"):
|
|
239
|
+
X, y = validate_data(
|
|
240
|
+
self,
|
|
241
|
+
X,
|
|
242
|
+
y,
|
|
243
|
+
dtype=[np.float64, np.float32],
|
|
244
|
+
copy=self.copy_X,
|
|
245
|
+
multi_output=True,
|
|
246
|
+
ensure_2d=True,
|
|
247
|
+
)
|
|
248
|
+
else:
|
|
249
|
+
X = check_array(
|
|
250
|
+
X,
|
|
251
|
+
dtype=[np.float64, np.float32],
|
|
252
|
+
copy=self.copy_X,
|
|
253
|
+
)
|
|
254
|
+
y = check_array(
|
|
255
|
+
y,
|
|
256
|
+
dtype=[np.float64, np.float32],
|
|
257
|
+
copy=False,
|
|
258
|
+
ensure_2d=False,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
n_samples, n_features = X.shape
|
|
262
|
+
|
|
263
|
+
is_underdetermined = n_samples < n_features + int(self.fit_intercept)
|
|
264
|
+
if is_underdetermined:
|
|
265
|
+
raise ValueError("Not enough samples to run oneDAL backend")
|
|
266
|
+
|
|
267
|
+
if self.batch_size is None:
|
|
268
|
+
self.batch_size_ = 5 * n_features
|
|
269
|
+
else:
|
|
270
|
+
self.batch_size_ = self.batch_size
|
|
271
|
+
|
|
272
|
+
self.n_samples_seen_ = 0
|
|
273
|
+
if hasattr(self, "_onedal_estimator"):
|
|
274
|
+
self._onedal_estimator._reset()
|
|
275
|
+
|
|
276
|
+
for batch in gen_batches(n_samples, self.batch_size_):
|
|
277
|
+
X_batch, y_batch = X[batch], y[batch]
|
|
278
|
+
self._onedal_partial_fit(X_batch, y_batch, check_input=False, queue=queue)
|
|
279
|
+
|
|
280
|
+
if sklearn_check_version("1.2"):
|
|
281
|
+
self._validate_params()
|
|
282
|
+
|
|
283
|
+
# finite check occurs on onedal side
|
|
284
|
+
self.n_features_in_ = n_features
|
|
285
|
+
|
|
286
|
+
if n_samples == 1:
|
|
287
|
+
warnings.warn(
|
|
288
|
+
"Only one sample available. You may want to reshape your data array"
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
self._onedal_finalize_fit(queue=queue)
|
|
292
|
+
return self
|
|
293
|
+
|
|
294
|
+
@property
|
|
295
|
+
def intercept_(self):
|
|
296
|
+
if hasattr(self, "_onedal_estimator"):
|
|
297
|
+
if self._need_to_finalize:
|
|
298
|
+
self._onedal_finalize_fit()
|
|
299
|
+
|
|
300
|
+
return self._onedal_estimator.intercept_
|
|
301
|
+
else:
|
|
302
|
+
raise AttributeError(
|
|
303
|
+
f"'{self.__class__.__name__}' object has no attribute 'intercept_'"
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
@intercept_.setter
|
|
307
|
+
def intercept_(self, value):
|
|
308
|
+
self.__dict__["intercept_"] = value
|
|
309
|
+
if hasattr(self, "_onedal_estimator"):
|
|
310
|
+
self._onedal_estimator.intercept_ = value
|
|
311
|
+
del self._onedal_estimator._onedal_model
|
|
312
|
+
|
|
313
|
+
@property
|
|
314
|
+
def coef_(self):
|
|
315
|
+
if hasattr(self, "_onedal_estimator"):
|
|
316
|
+
if self._need_to_finalize:
|
|
317
|
+
self._onedal_finalize_fit()
|
|
318
|
+
|
|
319
|
+
return self._onedal_estimator.coef_
|
|
320
|
+
else:
|
|
321
|
+
raise AttributeError(
|
|
322
|
+
f"'{self.__class__.__name__}' object has no attribute 'coef_'"
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
@coef_.setter
|
|
326
|
+
def coef_(self, value):
|
|
327
|
+
self.__dict__["coef_"] = value
|
|
328
|
+
if hasattr(self, "_onedal_estimator"):
|
|
329
|
+
self._onedal_estimator.coef_ = value
|
|
330
|
+
del self._onedal_estimator._onedal_model
|
|
331
|
+
|
|
332
|
+
def partial_fit(self, X, y, check_input=True):
|
|
333
|
+
"""
|
|
334
|
+
Incremental fit linear model with X and y. All of X and y is
|
|
335
|
+
processed as a single batch.
|
|
336
|
+
|
|
337
|
+
Parameters
|
|
338
|
+
----------
|
|
339
|
+
X : array-like of shape (n_samples, n_features)
|
|
340
|
+
Training data, where ``n_samples`` is the number of samples and
|
|
341
|
+
`n_features` is the number of features.
|
|
342
|
+
|
|
343
|
+
y : array-like of shape (n_samples,) or (n_samples, n_targets)
|
|
344
|
+
Target values, where ``n_samples`` is the number of samples and
|
|
345
|
+
``n_targets`` is the number of targets.
|
|
346
|
+
|
|
347
|
+
Returns
|
|
348
|
+
-------
|
|
349
|
+
self : object
|
|
350
|
+
Returns the instance itself.
|
|
351
|
+
"""
|
|
352
|
+
|
|
353
|
+
dispatch(
|
|
354
|
+
self,
|
|
355
|
+
"partial_fit",
|
|
356
|
+
{
|
|
357
|
+
"onedal": self.__class__._onedal_partial_fit,
|
|
358
|
+
"sklearn": None,
|
|
359
|
+
},
|
|
360
|
+
X,
|
|
361
|
+
y,
|
|
362
|
+
check_input=check_input,
|
|
363
|
+
)
|
|
364
|
+
return self
|
|
365
|
+
|
|
366
|
+
def fit(self, X, y):
|
|
367
|
+
"""
|
|
368
|
+
Fit the model with X and y, using minibatches of size ``batch_size``.
|
|
369
|
+
|
|
370
|
+
Parameters
|
|
371
|
+
----------
|
|
372
|
+
X : array-like of shape (n_samples, n_features)
|
|
373
|
+
Training data, where ``n_samples`` is the number of samples and
|
|
374
|
+
``n_features`` is the number of features. It is necessary for
|
|
375
|
+
``n_samples`` to be not less than ``n_features`` if ``fit_intercept``
|
|
376
|
+
is False and not less than ``n_features + 1`` if ``fit_intercept``
|
|
377
|
+
is True
|
|
378
|
+
|
|
379
|
+
y : array-like of shape (n_samples,) or (n_samples, n_targets)
|
|
380
|
+
Target values, where ``n_samples`` is the number of samples and
|
|
381
|
+
``n_targets`` is the number of targets.
|
|
382
|
+
|
|
383
|
+
Returns
|
|
384
|
+
-------
|
|
385
|
+
self : object
|
|
386
|
+
Returns the instance itself.
|
|
387
|
+
"""
|
|
388
|
+
|
|
389
|
+
dispatch(
|
|
390
|
+
self,
|
|
391
|
+
"fit",
|
|
392
|
+
{
|
|
393
|
+
"onedal": self.__class__._onedal_fit,
|
|
394
|
+
"sklearn": None,
|
|
395
|
+
},
|
|
396
|
+
X,
|
|
397
|
+
y,
|
|
398
|
+
)
|
|
399
|
+
return self
|
|
400
|
+
|
|
401
|
+
@wrap_output_data
|
|
402
|
+
def predict(self, X, y=None):
|
|
403
|
+
"""
|
|
404
|
+
Predict using the linear model.
|
|
405
|
+
|
|
406
|
+
Parameters
|
|
407
|
+
----------
|
|
408
|
+
X : array-like or sparse matrix, shape (n_samples, n_features)
|
|
409
|
+
Samples.
|
|
410
|
+
|
|
411
|
+
y : Ignored
|
|
412
|
+
Not used, present for API consistency by convention.
|
|
413
|
+
|
|
414
|
+
Returns
|
|
415
|
+
-------
|
|
416
|
+
C : array, shape (n_samples, n_targets)
|
|
417
|
+
Returns predicted values.
|
|
418
|
+
"""
|
|
419
|
+
check_is_fitted(self)
|
|
420
|
+
return dispatch(
|
|
421
|
+
self,
|
|
422
|
+
"predict",
|
|
423
|
+
{
|
|
424
|
+
"onedal": self.__class__._onedal_predict,
|
|
425
|
+
"sklearn": None,
|
|
426
|
+
},
|
|
427
|
+
X,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
@wrap_output_data
|
|
431
|
+
def score(self, X, y, sample_weight=None):
|
|
432
|
+
"""Return the coefficient of determination of the prediction.
|
|
433
|
+
|
|
434
|
+
The coefficient of determination :math:`R^2` is defined as
|
|
435
|
+
:math:`(1 - \\frac{u}{v})`, where :math:`u` is the residual
|
|
436
|
+
sum of squares ``((y_true - y_pred)** 2).sum()`` and :math:`v`
|
|
437
|
+
is the total sum of squares ``((y_true - y_true.mean()) ** 2).sum()``.
|
|
438
|
+
The best possible score is 1.0 and it can be negative (because the
|
|
439
|
+
model can be arbitrarily worse). A constant model that always predicts
|
|
440
|
+
the expected value of `y`, disregarding the input features, would get
|
|
441
|
+
a :math:`R^2` score of 0.0.
|
|
442
|
+
|
|
443
|
+
Parameters
|
|
444
|
+
----------
|
|
445
|
+
X : array-like of shape (n_samples, n_features)
|
|
446
|
+
Test samples. For some estimators this may be a precomputed
|
|
447
|
+
kernel matrix or a list of generic objects instead with shape
|
|
448
|
+
``(n_samples, n_samples_fitted)``, where ``n_samples_fitted``
|
|
449
|
+
is the number of samples used in the fitting for the estimator.
|
|
450
|
+
|
|
451
|
+
y : array-like of shape (n_samples,) or (n_samples, n_outputs)
|
|
452
|
+
True values for `X`.
|
|
453
|
+
|
|
454
|
+
sample_weight : array-like of shape (n_samples,), default=None
|
|
455
|
+
Sample weights.
|
|
456
|
+
|
|
457
|
+
Returns
|
|
458
|
+
-------
|
|
459
|
+
score : float
|
|
460
|
+
:math:`R^2` of ``self.predict(X)`` w.r.t. `y`.
|
|
461
|
+
|
|
462
|
+
Notes
|
|
463
|
+
-----
|
|
464
|
+
The :math:`R^2` score used when calling ``score`` on a regressor uses
|
|
465
|
+
``multioutput='uniform_average'`` from version 0.23 to keep consistent
|
|
466
|
+
with default value of :func:`~sklearn.metrics.r2_score`.
|
|
467
|
+
This influences the ``score`` method of all the multioutput
|
|
468
|
+
regressors (except for
|
|
469
|
+
:class:`~sklearn.multioutput.MultiOutputRegressor`).
|
|
470
|
+
"""
|
|
471
|
+
check_is_fitted(self)
|
|
472
|
+
return dispatch(
|
|
473
|
+
self,
|
|
474
|
+
"score",
|
|
475
|
+
{
|
|
476
|
+
"onedal": self.__class__._onedal_score,
|
|
477
|
+
"sklearn": None,
|
|
478
|
+
},
|
|
479
|
+
X,
|
|
480
|
+
y,
|
|
481
|
+
sample_weight=sample_weight,
|
|
482
|
+
)
|