scikit-learn-intelex 2025.10.0__py313-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/_daal4py.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/gbt_convertors.py +1199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/logistic_regression_builders.py +211 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/tree_based_builders.py +425 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +528 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +192 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +333 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1285 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +826 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +290 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +561 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_enet.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +432 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +259 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/_models_info.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_patching.py +90 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +493 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +136 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +736 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +772 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/__init__.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_config.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_device_offload.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +279 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/utils.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +582 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +145 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_backend.py +258 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/tests/test_sycl.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +121 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +190 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_dlpack.py +64 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_sycl_usm.py +63 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +131 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +686 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +218 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +291 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/dummy.py +137 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +781 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +201 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +230 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +293 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +171 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +690 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +202 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/svm.py +592 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +352 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +168 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/test_common.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +179 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +98 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_sycl_queue_manager.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_third_party.py +220 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/tests/test_validation.py +142 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/validation.py +503 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__init__.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_config.py +163 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +205 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_utils.py +219 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/base.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +338 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +405 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +455 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +399 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +38 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +440 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +307 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +558 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dispatcher.py +572 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +629 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/_dummy.py +615 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/tests/test_dummy.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/_forest.py +1799 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +196 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/__main__.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/dispatcher.py +101 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +44 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +427 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +363 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_regression.py +466 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +267 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +214 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_ridge.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/pairwise.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/ranking.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +39 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/split.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +34 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/common.py +313 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +170 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/__init__.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +261 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +112 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +406 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +390 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/__init__.py +25 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +314 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +26 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +108 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +180 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +120 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +200 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +276 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +146 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +345 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +162 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +169 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +433 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +403 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvc.py +278 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvr.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svc.py +306 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svr.py +155 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +607 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_hyperparameters.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_parallel.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +418 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +420 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +217 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/class_weight.py +100 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/parallel.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_class_weight.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_validation.py +238 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/validation.py +212 -0
- scikit_learn_intelex-2025.10.0.dist-info/LICENSE.txt +202 -0
- scikit_learn_intelex-2025.10.0.dist-info/METADATA +182 -0
- scikit_learn_intelex-2025.10.0.dist-info/RECORD +267 -0
- scikit_learn_intelex-2025.10.0.dist-info/WHEEL +5 -0
- scikit_learn_intelex-2025.10.0.dist-info/top_level.txt +1 -0
scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2023 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ==============================================================================
|
|
16
|
+
|
|
17
|
+
from .basic_statistics import BasicStatistics
|
|
18
|
+
from .incremental_basic_statistics import IncrementalBasicStatistics
|
|
19
|
+
|
|
20
|
+
__all__ = ["BasicStatistics", "IncrementalBasicStatistics"]
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2023 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ==============================================================================
|
|
16
|
+
|
|
17
|
+
import warnings
|
|
18
|
+
|
|
19
|
+
from scipy.sparse import issparse
|
|
20
|
+
from sklearn.base import BaseEstimator
|
|
21
|
+
|
|
22
|
+
from daal4py.sklearn._n_jobs_support import control_n_jobs
|
|
23
|
+
from daal4py.sklearn._utils import daal_check_version, sklearn_check_version
|
|
24
|
+
from onedal.basic_statistics import BasicStatistics as onedal_BasicStatistics
|
|
25
|
+
from onedal.utils.validation import _is_csr
|
|
26
|
+
|
|
27
|
+
from .._config import get_config
|
|
28
|
+
from .._device_offload import dispatch
|
|
29
|
+
from .._utils import PatchingConditionsChain
|
|
30
|
+
from ..base import oneDALEstimator
|
|
31
|
+
from ..utils._array_api import enable_array_api, get_namespace
|
|
32
|
+
from ..utils.validation import _check_sample_weight, validate_data
|
|
33
|
+
|
|
34
|
+
if sklearn_check_version("1.2"):
|
|
35
|
+
from sklearn.utils._param_validation import StrOptions
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@enable_array_api
|
|
39
|
+
@control_n_jobs(decorated_methods=["fit"])
|
|
40
|
+
class BasicStatistics(oneDALEstimator, BaseEstimator):
|
|
41
|
+
"""
|
|
42
|
+
Estimator for basic statistics.
|
|
43
|
+
|
|
44
|
+
Compute low order moments and related statistics for given data.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
result_options : str or list, default=str('all')
|
|
49
|
+
Used to set statistics to calculate. Possible values are ``'min'``, ``'max'``, ``'sum'``, ``'mean'``, ``'variance'``,
|
|
50
|
+
``'variation'``, ``sum_squares'``, ``sum_squares_centered'``, ``'standard_deviation'``, ``'second_order_raw_moment'``
|
|
51
|
+
or a list containing any of these values. If set to ``'all'`` then all possible statistics will be
|
|
52
|
+
calculated.
|
|
53
|
+
|
|
54
|
+
Attributes
|
|
55
|
+
----------
|
|
56
|
+
min_ : ndarray of shape (n_features,)
|
|
57
|
+
Minimum of each feature over all samples.
|
|
58
|
+
max_ : ndarray of shape (n_features,)
|
|
59
|
+
Maximum of each feature over all samples.
|
|
60
|
+
sum_ : ndarray of shape (n_features,)
|
|
61
|
+
Sum of each feature over all samples.
|
|
62
|
+
mean_ : ndarray of shape (n_features,)
|
|
63
|
+
Mean of each feature over all samples.
|
|
64
|
+
variance_ : ndarray of shape (n_features,)
|
|
65
|
+
Variance of each feature over all samples. Bessel's correction is used.
|
|
66
|
+
variation_ : ndarray of shape (n_features,)
|
|
67
|
+
Variation of each feature over all samples. Bessel's correction is used.
|
|
68
|
+
sum_squares_ : ndarray of shape (n_features,)
|
|
69
|
+
Sum of squares for each feature over all samples.
|
|
70
|
+
standard_deviation_ : ndarray of shape (n_features,)
|
|
71
|
+
Unbiased standard deviation of each feature over all samples. Bessel's correction is used.
|
|
72
|
+
sum_squares_centered_ : ndarray of shape (n_features,)
|
|
73
|
+
Centered sum of squares for each feature over all samples.
|
|
74
|
+
second_order_raw_moment_ : ndarray of shape (n_features,)
|
|
75
|
+
Second order moment of each feature over all samples.
|
|
76
|
+
|
|
77
|
+
Notes
|
|
78
|
+
-----
|
|
79
|
+
Attribute exists only if corresponding result option has been provided.
|
|
80
|
+
|
|
81
|
+
Names of attributes without the trailing underscore are
|
|
82
|
+
supported currently but deprecated in 2025.1 and will be removed in 2026.0
|
|
83
|
+
|
|
84
|
+
Some results can exhibit small variations due to
|
|
85
|
+
floating point error accumulation and multithreading.
|
|
86
|
+
|
|
87
|
+
Examples
|
|
88
|
+
--------
|
|
89
|
+
>>> import numpy as np
|
|
90
|
+
>>> from sklearnex.basic_statistics import BasicStatistics
|
|
91
|
+
>>> bs = BasicStatistics(result_options=['sum', 'min', 'max'])
|
|
92
|
+
>>> X = np.array([[1, 2], [3, 4]])
|
|
93
|
+
>>> bs.fit(X)
|
|
94
|
+
>>> bs.sum_
|
|
95
|
+
np.array([4., 6.])
|
|
96
|
+
>>> bs.min_
|
|
97
|
+
np.array([1., 2.])
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
def __init__(self, result_options="all"):
|
|
101
|
+
self.result_options = result_options
|
|
102
|
+
|
|
103
|
+
_onedal_basic_statistics = staticmethod(onedal_BasicStatistics)
|
|
104
|
+
|
|
105
|
+
if sklearn_check_version("1.2"):
|
|
106
|
+
_parameter_constraints: dict = {
|
|
107
|
+
"result_options": [
|
|
108
|
+
StrOptions(
|
|
109
|
+
{
|
|
110
|
+
"all",
|
|
111
|
+
"min",
|
|
112
|
+
"max",
|
|
113
|
+
"sum",
|
|
114
|
+
"mean",
|
|
115
|
+
"variance",
|
|
116
|
+
"variation",
|
|
117
|
+
"sum_squares",
|
|
118
|
+
"standard_deviation",
|
|
119
|
+
"sum_squares_centered",
|
|
120
|
+
"second_order_raw_moment",
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
list,
|
|
124
|
+
],
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
def _save_attributes(self):
|
|
128
|
+
assert hasattr(self, "_onedal_estimator")
|
|
129
|
+
for option in self._onedal_estimator.options:
|
|
130
|
+
option += "_"
|
|
131
|
+
setattr(self, option, getattr(self._onedal_estimator, option))
|
|
132
|
+
|
|
133
|
+
def __getattr__(self, attr):
|
|
134
|
+
is_deprecated_attr = (
|
|
135
|
+
attr in self._onedal_estimator.options
|
|
136
|
+
if "_onedal_estimator" in self.__dict__
|
|
137
|
+
else False
|
|
138
|
+
)
|
|
139
|
+
if is_deprecated_attr:
|
|
140
|
+
warnings.warn(
|
|
141
|
+
"Result attributes without a trailing underscore were deprecated in version 2025.1 and will be removed in 2026.0"
|
|
142
|
+
)
|
|
143
|
+
attr += "_"
|
|
144
|
+
if attr in self.__dict__:
|
|
145
|
+
return self.__dict__[attr]
|
|
146
|
+
|
|
147
|
+
raise AttributeError(
|
|
148
|
+
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
def _onedal_cpu_supported(self, method_name, *data):
|
|
152
|
+
patching_status = PatchingConditionsChain(
|
|
153
|
+
f"sklearnex.basic_statistics.{self.__class__.__name__}.{method_name}"
|
|
154
|
+
)
|
|
155
|
+
return patching_status
|
|
156
|
+
|
|
157
|
+
def _onedal_gpu_supported(self, method_name, *data):
|
|
158
|
+
patching_status = PatchingConditionsChain(
|
|
159
|
+
f"sklearnex.basic_statistics.{self.__class__.__name__}.{method_name}"
|
|
160
|
+
)
|
|
161
|
+
X, sample_weight = data
|
|
162
|
+
|
|
163
|
+
is_data_supported = not issparse(X) or (
|
|
164
|
+
_is_csr(X) and daal_check_version((2025, "P", 200))
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
is_sample_weight_supported = sample_weight is None or not issparse(X)
|
|
168
|
+
|
|
169
|
+
patching_status.and_conditions(
|
|
170
|
+
[
|
|
171
|
+
(
|
|
172
|
+
is_sample_weight_supported,
|
|
173
|
+
"Sample weights are not supported for CSR data format",
|
|
174
|
+
),
|
|
175
|
+
(
|
|
176
|
+
is_data_supported,
|
|
177
|
+
"Supported data formats: Dense, CSR (oneDAL version >= 2025.2.0).",
|
|
178
|
+
),
|
|
179
|
+
]
|
|
180
|
+
)
|
|
181
|
+
return patching_status
|
|
182
|
+
|
|
183
|
+
def _onedal_fit(self, X, sample_weight=None, queue=None):
|
|
184
|
+
if not get_config()["use_raw_input"]:
|
|
185
|
+
xp, _ = get_namespace(X, sample_weight)
|
|
186
|
+
X = validate_data(
|
|
187
|
+
self,
|
|
188
|
+
X,
|
|
189
|
+
dtype=[xp.float64, xp.float32],
|
|
190
|
+
ensure_2d=False,
|
|
191
|
+
accept_sparse="csr",
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
if sample_weight is not None:
|
|
195
|
+
sample_weight = _check_sample_weight(
|
|
196
|
+
sample_weight, X, dtype=[xp.float64, xp.float32]
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
onedal_params = {
|
|
200
|
+
"result_options": self.result_options,
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if not hasattr(self, "_onedal_estimator"):
|
|
204
|
+
self._onedal_estimator = self._onedal_basic_statistics(**onedal_params)
|
|
205
|
+
self._onedal_estimator.fit(X, sample_weight, queue=queue)
|
|
206
|
+
self._save_attributes()
|
|
207
|
+
self.n_features_in_ = X.shape[1] if len(X.shape) > 1 else 1
|
|
208
|
+
|
|
209
|
+
def fit(self, X, y=None, sample_weight=None):
|
|
210
|
+
"""Calculate statistics of X.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
X : array-like of shape (n_samples, n_features)
|
|
215
|
+
Data for compute, where ``n_samples`` is the number of samples and
|
|
216
|
+
``n_features`` is the number of features.
|
|
217
|
+
|
|
218
|
+
y : Ignored
|
|
219
|
+
Not used, present for API consistency by convention.
|
|
220
|
+
|
|
221
|
+
sample_weight : array-like of shape (n_samples,), default=None
|
|
222
|
+
Weights for compute weighted statistics, where ``n_samples`` is the number of samples.
|
|
223
|
+
|
|
224
|
+
Returns
|
|
225
|
+
-------
|
|
226
|
+
self : object
|
|
227
|
+
Returns the instance itself.
|
|
228
|
+
"""
|
|
229
|
+
if sklearn_check_version("1.2"):
|
|
230
|
+
self._validate_params()
|
|
231
|
+
dispatch(
|
|
232
|
+
self,
|
|
233
|
+
"fit",
|
|
234
|
+
{
|
|
235
|
+
"onedal": self.__class__._onedal_fit,
|
|
236
|
+
"sklearn": None,
|
|
237
|
+
},
|
|
238
|
+
X,
|
|
239
|
+
sample_weight,
|
|
240
|
+
)
|
|
241
|
+
return self
|
|
@@ -0,0 +1,338 @@
|
|
|
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
|
+
from sklearn.base import BaseEstimator
|
|
18
|
+
from sklearn.utils import gen_batches
|
|
19
|
+
|
|
20
|
+
from daal4py.sklearn._n_jobs_support import control_n_jobs
|
|
21
|
+
from daal4py.sklearn._utils import sklearn_check_version
|
|
22
|
+
from onedal.basic_statistics import (
|
|
23
|
+
IncrementalBasicStatistics as onedal_IncrementalBasicStatistics,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
from .._config import get_config
|
|
27
|
+
from .._device_offload import dispatch
|
|
28
|
+
from .._utils import PatchingConditionsChain, _add_inc_serialization_note
|
|
29
|
+
from ..base import oneDALEstimator
|
|
30
|
+
from ..utils._array_api import enable_array_api, get_namespace
|
|
31
|
+
from ..utils.validation import _check_sample_weight, validate_data
|
|
32
|
+
|
|
33
|
+
if sklearn_check_version("1.2"):
|
|
34
|
+
from sklearn.utils._param_validation import Interval, StrOptions
|
|
35
|
+
|
|
36
|
+
import numbers
|
|
37
|
+
import warnings
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@enable_array_api
|
|
41
|
+
@control_n_jobs(decorated_methods=["partial_fit", "_onedal_finalize_fit"])
|
|
42
|
+
class IncrementalBasicStatistics(oneDALEstimator, BaseEstimator):
|
|
43
|
+
"""
|
|
44
|
+
Incremental estimator for basic statistics.
|
|
45
|
+
|
|
46
|
+
Calculates basic statistics on the given data, allows for computation
|
|
47
|
+
when the data are split into batches. The user can use :meth:`partial_fit`
|
|
48
|
+
method to provide a single batch of data or use the :meth:`fit` method to
|
|
49
|
+
provide the entire dataset.
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
result_options : str or list, default=str('all')
|
|
54
|
+
List of statistics to compute.
|
|
55
|
+
|
|
56
|
+
batch_size : int, default=None
|
|
57
|
+
The number of samples to use for each batch. Only used when calling
|
|
58
|
+
:meth:`fit`. If ``batch_size`` is ``None``, then ``batch_size``
|
|
59
|
+
is inferred from the data and set to ``5 * n_features``.
|
|
60
|
+
|
|
61
|
+
Attributes
|
|
62
|
+
----------
|
|
63
|
+
min_ : ndarray of shape (n_features,)
|
|
64
|
+
Minimum of each feature over all samples.
|
|
65
|
+
|
|
66
|
+
max_ : ndarray of shape (n_features,)
|
|
67
|
+
Maximum of each feature over all samples.
|
|
68
|
+
|
|
69
|
+
sum_ : ndarray of shape (n_features,)
|
|
70
|
+
Sum of each feature over all samples.
|
|
71
|
+
|
|
72
|
+
mean_ : ndarray of shape (n_features,)
|
|
73
|
+
Mean of each feature over all samples.
|
|
74
|
+
|
|
75
|
+
variance_ : ndarray of shape (n_features,)
|
|
76
|
+
Variance of each feature over all samples.
|
|
77
|
+
|
|
78
|
+
variation_ : ndarray of shape (n_features,)
|
|
79
|
+
Variation of each feature over all samples.
|
|
80
|
+
|
|
81
|
+
sum_squares_ : ndarray of shape (n_features,)
|
|
82
|
+
Sum of squares for each feature over all samples.
|
|
83
|
+
|
|
84
|
+
standard_deviation_ : ndarray of shape (n_features,)
|
|
85
|
+
Standard deviation of each feature over all samples.
|
|
86
|
+
|
|
87
|
+
sum_squares_centered_ : ndarray of shape (n_features,)
|
|
88
|
+
Centered sum of squares for each feature over all samples.
|
|
89
|
+
|
|
90
|
+
second_order_raw_moment_ : ndarray of shape (n_features,)
|
|
91
|
+
Second order moment of each feature over all samples.
|
|
92
|
+
|
|
93
|
+
n_samples_seen_ : int
|
|
94
|
+
The number of samples processed by the estimator. Will be reset
|
|
95
|
+
on new calls to ``fit``, but increments across ``partial_fit``
|
|
96
|
+
calls.
|
|
97
|
+
|
|
98
|
+
batch_size_ : int
|
|
99
|
+
Inferred batch size from ``batch_size``.
|
|
100
|
+
|
|
101
|
+
n_features_in_ : int
|
|
102
|
+
Number of features seen during :meth:`fit` or :meth:`partial_fit`.
|
|
103
|
+
|
|
104
|
+
Notes
|
|
105
|
+
-----
|
|
106
|
+
Attribute exists only if corresponding result option has been provided.
|
|
107
|
+
|
|
108
|
+
Names of attributes without the trailing underscore are supported
|
|
109
|
+
currently but deprecated in 2025.1 and will be removed in 2026.0.
|
|
110
|
+
|
|
111
|
+
Sparse data formats are not supported. Input dtype must be ``float32`` or ``float64``.
|
|
112
|
+
|
|
113
|
+
%incremental_serialization_note%
|
|
114
|
+
|
|
115
|
+
Examples
|
|
116
|
+
--------
|
|
117
|
+
>>> import numpy as np
|
|
118
|
+
>>> from sklearnex.basic_statistics import IncrementalBasicStatistics
|
|
119
|
+
>>> incbs = IncrementalBasicStatistics(batch_size=1)
|
|
120
|
+
>>> X = np.array([[1, 2], [3, 4]])
|
|
121
|
+
>>> incbs.partial_fit(X[:1])
|
|
122
|
+
>>> incbs.partial_fit(X[1:])
|
|
123
|
+
>>> incbs.sum_
|
|
124
|
+
np.array([4., 6.])
|
|
125
|
+
>>> incbs.min_
|
|
126
|
+
np.array([1., 2.])
|
|
127
|
+
>>> incbs.fit(X)
|
|
128
|
+
>>> incbs.sum_
|
|
129
|
+
np.array([4., 6.])
|
|
130
|
+
>>> incbs.max_
|
|
131
|
+
np.array([3., 4.])
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
__doc__ = _add_inc_serialization_note(__doc__)
|
|
135
|
+
|
|
136
|
+
_onedal_incremental_basic_statistics = staticmethod(onedal_IncrementalBasicStatistics)
|
|
137
|
+
|
|
138
|
+
if sklearn_check_version("1.2"):
|
|
139
|
+
_parameter_constraints: dict = {
|
|
140
|
+
"result_options": [
|
|
141
|
+
StrOptions(
|
|
142
|
+
{
|
|
143
|
+
"all",
|
|
144
|
+
"min",
|
|
145
|
+
"max",
|
|
146
|
+
"sum",
|
|
147
|
+
"mean",
|
|
148
|
+
"variance",
|
|
149
|
+
"variation",
|
|
150
|
+
"sum_squares",
|
|
151
|
+
"standard_deviation",
|
|
152
|
+
"sum_squares_centered",
|
|
153
|
+
"second_order_raw_moment",
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
list,
|
|
157
|
+
],
|
|
158
|
+
"batch_size": [Interval(numbers.Integral, 1, None, closed="left"), None],
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
def __init__(self, result_options="all", batch_size=None):
|
|
162
|
+
self.result_options = result_options
|
|
163
|
+
self._need_to_finalize = False
|
|
164
|
+
self.batch_size = batch_size
|
|
165
|
+
|
|
166
|
+
def _onedal_supported(self, method_name, *data):
|
|
167
|
+
patching_status = PatchingConditionsChain(
|
|
168
|
+
f"sklearn.basic_statistics.{self.__class__.__name__}.{method_name}"
|
|
169
|
+
)
|
|
170
|
+
return patching_status
|
|
171
|
+
|
|
172
|
+
_onedal_cpu_supported = _onedal_supported
|
|
173
|
+
_onedal_gpu_supported = _onedal_supported
|
|
174
|
+
|
|
175
|
+
def _onedal_finalize_fit(self, queue=None):
|
|
176
|
+
assert hasattr(self, "_onedal_estimator")
|
|
177
|
+
self._onedal_estimator.finalize_fit()
|
|
178
|
+
self._need_to_finalize = False
|
|
179
|
+
|
|
180
|
+
def _onedal_partial_fit(self, X, sample_weight=None, queue=None, check_input=True):
|
|
181
|
+
first_pass = not hasattr(self, "n_samples_seen_") or self.n_samples_seen_ == 0
|
|
182
|
+
|
|
183
|
+
# never check input when using raw input
|
|
184
|
+
if check_input and not get_config()["use_raw_input"]:
|
|
185
|
+
xp, _ = get_namespace(X)
|
|
186
|
+
X = validate_data(
|
|
187
|
+
self,
|
|
188
|
+
X,
|
|
189
|
+
dtype=[xp.float64, xp.float32],
|
|
190
|
+
reset=first_pass,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
if sample_weight is not None:
|
|
194
|
+
sample_weight = _check_sample_weight(
|
|
195
|
+
sample_weight, X, dtype=[xp.float64, xp.float32]
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
if first_pass:
|
|
199
|
+
self.n_samples_seen_ = X.shape[0]
|
|
200
|
+
self.n_features_in_ = X.shape[1]
|
|
201
|
+
else:
|
|
202
|
+
self.n_samples_seen_ += X.shape[0]
|
|
203
|
+
|
|
204
|
+
if not hasattr(self, "_onedal_estimator"):
|
|
205
|
+
self._onedal_estimator = self._onedal_incremental_basic_statistics(
|
|
206
|
+
result_options=self.result_options
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
self._onedal_estimator.partial_fit(X, sample_weight=sample_weight, queue=queue)
|
|
210
|
+
self._need_to_finalize = True
|
|
211
|
+
|
|
212
|
+
def _onedal_fit(self, X, sample_weight=None, queue=None):
|
|
213
|
+
if not get_config()["use_raw_input"]:
|
|
214
|
+
xp, _ = get_namespace(X, sample_weight)
|
|
215
|
+
X = validate_data(self, X, dtype=[xp.float64, xp.float32])
|
|
216
|
+
|
|
217
|
+
if sample_weight is not None:
|
|
218
|
+
sample_weight = _check_sample_weight(
|
|
219
|
+
sample_weight, X, dtype=[xp.float64, xp.float32]
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
_, n_features = X.shape
|
|
223
|
+
if self.batch_size is None:
|
|
224
|
+
self.batch_size_ = 5 * n_features
|
|
225
|
+
else:
|
|
226
|
+
self.batch_size_ = self.batch_size
|
|
227
|
+
|
|
228
|
+
self.n_samples_seen_ = 0
|
|
229
|
+
if hasattr(self, "_onedal_estimator"):
|
|
230
|
+
self._onedal_estimator._reset()
|
|
231
|
+
|
|
232
|
+
for batch in gen_batches(X.shape[0], self.batch_size_):
|
|
233
|
+
X_batch = X[batch]
|
|
234
|
+
weights_batch = sample_weight[batch] if sample_weight is not None else None
|
|
235
|
+
self._onedal_partial_fit(
|
|
236
|
+
X_batch, weights_batch, queue=queue, check_input=False
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
self.n_features_in_ = X.shape[1]
|
|
240
|
+
|
|
241
|
+
self._onedal_finalize_fit()
|
|
242
|
+
|
|
243
|
+
return self
|
|
244
|
+
|
|
245
|
+
def __getattr__(self, attr):
|
|
246
|
+
sattr = attr.removesuffix("_")
|
|
247
|
+
is_statistic_attr = (
|
|
248
|
+
sattr in self._onedal_estimator.options
|
|
249
|
+
if "_onedal_estimator" in self.__dict__
|
|
250
|
+
else False
|
|
251
|
+
)
|
|
252
|
+
if is_statistic_attr:
|
|
253
|
+
if self._need_to_finalize:
|
|
254
|
+
self._onedal_finalize_fit()
|
|
255
|
+
if sattr == attr:
|
|
256
|
+
warnings.warn(
|
|
257
|
+
"Result attributes without a trailing underscore were deprecated in version 2025.1 and will be removed in 2026.0"
|
|
258
|
+
)
|
|
259
|
+
attr += "_"
|
|
260
|
+
return getattr(self._onedal_estimator, attr)
|
|
261
|
+
if attr in self.__dict__:
|
|
262
|
+
return self.__dict__[attr]
|
|
263
|
+
|
|
264
|
+
raise AttributeError(
|
|
265
|
+
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
def partial_fit(self, X, sample_weight=None, check_input=True):
|
|
269
|
+
"""Incremental fit with X. All of X is processed as a single batch.
|
|
270
|
+
|
|
271
|
+
Parameters
|
|
272
|
+
----------
|
|
273
|
+
X : array-like of shape (n_samples, n_features)
|
|
274
|
+
Data for compute, where ``n_samples`` is the number of samples and
|
|
275
|
+
``n_features`` is the number of features.
|
|
276
|
+
|
|
277
|
+
y : Ignored
|
|
278
|
+
Not used, present for API consistency by convention.
|
|
279
|
+
|
|
280
|
+
sample_weight : array-like of shape (n_samples,), default=None
|
|
281
|
+
Weights for compute weighted statistics, where ``n_samples`` is the number of samples.
|
|
282
|
+
|
|
283
|
+
check_input : bool, default=True
|
|
284
|
+
Run ``check_array`` on X.
|
|
285
|
+
|
|
286
|
+
Returns
|
|
287
|
+
-------
|
|
288
|
+
self : IncrementalBasicStatistics
|
|
289
|
+
Returns the instance itself.
|
|
290
|
+
"""
|
|
291
|
+
if sklearn_check_version("1.2") and check_input:
|
|
292
|
+
self._validate_params()
|
|
293
|
+
dispatch(
|
|
294
|
+
self,
|
|
295
|
+
"partial_fit",
|
|
296
|
+
{
|
|
297
|
+
"onedal": self.__class__._onedal_partial_fit,
|
|
298
|
+
"sklearn": None,
|
|
299
|
+
},
|
|
300
|
+
X,
|
|
301
|
+
sample_weight,
|
|
302
|
+
check_input=check_input,
|
|
303
|
+
)
|
|
304
|
+
return self
|
|
305
|
+
|
|
306
|
+
def fit(self, X, y=None, sample_weight=None):
|
|
307
|
+
"""Calculate statistics of X using minibatches of size ``batch_size``.
|
|
308
|
+
|
|
309
|
+
Parameters
|
|
310
|
+
----------
|
|
311
|
+
X : array-like of shape (n_samples, n_features)
|
|
312
|
+
Data for compute, where ``n_samples`` is the number of samples and
|
|
313
|
+
``n_features`` is the number of features.
|
|
314
|
+
|
|
315
|
+
y : Ignored
|
|
316
|
+
Not used, present for API consistency by convention.
|
|
317
|
+
|
|
318
|
+
sample_weight : array-like of shape (n_samples,), default=None
|
|
319
|
+
Weights for compute weighted statistics, where ``n_samples`` is the number of samples.
|
|
320
|
+
|
|
321
|
+
Returns
|
|
322
|
+
-------
|
|
323
|
+
self : IncrementalBasicStatistics
|
|
324
|
+
Returns the instance itself.
|
|
325
|
+
"""
|
|
326
|
+
if sklearn_check_version("1.2"):
|
|
327
|
+
self._validate_params()
|
|
328
|
+
dispatch(
|
|
329
|
+
self,
|
|
330
|
+
"fit",
|
|
331
|
+
{
|
|
332
|
+
"onedal": self.__class__._onedal_fit,
|
|
333
|
+
"sklearn": None,
|
|
334
|
+
},
|
|
335
|
+
X,
|
|
336
|
+
sample_weight,
|
|
337
|
+
)
|
|
338
|
+
return self
|