scikit-learn-intelex 2025.10.0__py313-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__init__.py +73 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/_daal4py.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/__init__.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/gbt_convertors.py +1199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/logistic_regression_builders.py +211 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mb/tree_based_builders.py +425 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/mpi_transceiver.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/__init__.py +40 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_n_jobs_support.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/_utils.py +245 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/dbscan.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/k_means.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/cluster/tests/test_dbscan.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/decomposition/_pca.py +528 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/AdaBoostClassifier.py +192 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/GBTDAAL.py +333 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/_forest.py +1285 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/ensemble/tests/test_decision_forest.py +206 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_coordinate_descent.py +826 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_linear.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/_ridge.py +290 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/coordinate_descent.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/linear.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_loss.py +195 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/logistic_path.py +561 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/ridge.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_enet.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_linear.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/linear_model/tests/test_ridge.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/manifold/_t_sne.py +432 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_pairwise.py +259 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/metrics/_ranking.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/_split.py +309 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/model_selection/tests/test_split.py +56 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/__init__.py +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py +232 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/_models_info.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_monkeypatch.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/test_patching.py +90 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_base.py +493 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_classification.py +136 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_regression.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/_unsupervised.py +55 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/neighbors/tests/test_kneighbors.py +113 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/svm/svm.py +736 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/base.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/tests/test_utils.py +51 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/daal4py/sklearn/utils/validation.py +772 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/__init__.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_config.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_device_offload.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_dpc.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/_onedal_py_host.cp313-win_amd64.pyd +0 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/basic_statistics.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/incremental_basic_statistics.py +165 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/test_incremental_basic_statistics.py +279 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/basic_statistics/tests/utils.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/dbscan.py +80 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans.py +582 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/kmeans_init.py +145 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_dbscan.py +125 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans.py +88 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/cluster/tests/test_kmeans_init.py +93 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_backend.py +258 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_estimator_checks.py +47 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/_mixin.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/hyperparameters.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/common/tests/test_sycl.py +148 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/covariance.py +121 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/incremental_covariance.py +151 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_covariance.py +50 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/covariance/tests/test_incremental_covariance.py +190 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_data_conversion.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_dlpack.py +64 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/_sycl_usm.py +63 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/common.py +131 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/datatypes/tests/test_data.py +686 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/incremental_pca.py +218 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/pca.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/decomposition/tests/test_incremental_pca.py +291 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/dummy/dummy.py +137 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/forest.py +781 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/ensemble/tests/test_random_forest.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/incremental_linear_model.py +201 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/linear_model.py +230 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/logistic_regression.py +293 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_linear_regression.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_incremental_ridge_regression.py +171 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_linear_regression.py +252 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_logistic_regression.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/linear_model/tests/test_ridge.py +95 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/neighbors.py +690 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/neighbors/tests/test_knn_classification.py +49 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/get_tree.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/kernel_functions.py +202 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/primitives/tests/test_kernel_functions.py +159 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/svm.py +592 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_csr_svm.py +352 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvc.py +204 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_nusvr.py +210 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svc.py +168 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/svm/tests/test_svr.py +243 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/test_common.py +71 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_dataframes_support.py +179 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/tests/utils/_device_selection.py +94 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_array_api.py +98 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_sycl_queue_manager.py +213 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/_third_party.py +220 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/tests/test_validation.py +142 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/onedal/utils/validation.py +503 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__init__.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/__main__.py +58 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_config.py +163 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_device_offload.py +205 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/_utils.py +219 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/base.py +109 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/basic_statistics.py +241 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/incremental_basic_statistics.py +338 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_basic_statistics.py +405 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/basic_statistics/tests/test_incremental_basic_statistics.py +455 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/dbscan.py +199 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/k_means.py +399 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_dbscan.py +38 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/cluster/tests/test_kmeans.py +157 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/conftest.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/incremental_covariance.py +440 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/covariance/tests/test_incremental_covariance.py +307 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/pca.py +558 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/decomposition/tests/test_pca.py +164 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dispatcher.py +572 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/doc/third-party-programs.txt +629 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/_dummy.py +615 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/dummy/tests/test_dummy.py +62 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/_forest.py +1799 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/ensemble/tests/test_forest.py +196 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/__main__.py +72 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/glob/dispatcher.py +101 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/__init__.py +32 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/coordinate_descent.py +44 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_linear.py +427 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/incremental_ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/linear.py +363 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/logistic_regression.py +466 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/ridge.py +407 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_linear.py +267 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_incremental_ridge.py +214 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_linear.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_logreg.py +565 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/linear_model/tests/test_ridge.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/t_sne.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/manifold/tests/test_tsne.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/pairwise.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/ranking.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/metrics/tests/test_metrics.py +39 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/split.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/model_selection/tests/test_model_selection.py +34 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/__init__.py +27 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/_lof.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/common.py +313 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_classification.py +189 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_regression.py +167 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/knn_unsupervised.py +170 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/neighbors/tests/test_neighbors.py +82 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/__init__.py +17 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/covariance.py +261 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/covariance/tests/test_covariance.py +112 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/incremental_pca.py +406 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/preview/decomposition/tests/test_incremental_pca.py +390 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/__init__.py +25 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/basic_statistics.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/incremental_basic_statistics.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_basic_statistics_spmd.py +117 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/basic_statistics/tests/test_incremental_basic_statistics_spmd.py +314 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/__init__.py +30 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/dbscan.py +26 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/kmeans.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_dbscan_spmd.py +108 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/cluster/tests/test_kmeans_spmd.py +180 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/covariance.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/incremental_covariance.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_covariance_spmd.py +120 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/covariance/tests/test_incremental_covariance_spmd.py +200 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/__init__.py +20 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/incremental_pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/pca.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_incremental_pca_spmd.py +276 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/decomposition/tests/test_pca_spmd.py +146 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/forest.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +299 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/__init__.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/incremental_linear_model.py +28 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/linear_model.py +24 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/logistic_regression.py +21 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_incremental_linear_spmd.py +345 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_linear_regression_spmd.py +162 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/linear_model/tests/test_logistic_regression_spmd.py +169 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/__init__.py +23 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +433 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/__init__.py +29 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/_common.py +403 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvc.py +278 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/nusvr.py +158 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svc.py +306 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/svr.py +155 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/svm/tests/test_svm.py +124 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_common.py +607 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_config.py +256 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_hyperparameters.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_memory_usage.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_monkeypatch.py +269 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_n_jobs_support.py +111 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_parallel.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_patching.py +418 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/test_run_to_run_stability.py +335 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/__init__.py +48 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/base.py +420 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/tests/utils/spmd.py +198 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/__init__.py +19 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/_array_api.py +217 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/class_weight.py +100 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/parallel.py +97 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_class_weight.py +69 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/tests/test_validation.py +238 -0
- scikit_learn_intelex-2025.10.0.data/data/Lib/site-packages/sklearnex/utils/validation.py +212 -0
- scikit_learn_intelex-2025.10.0.dist-info/LICENSE.txt +202 -0
- scikit_learn_intelex-2025.10.0.dist-info/METADATA +182 -0
- scikit_learn_intelex-2025.10.0.dist-info/RECORD +267 -0
- scikit_learn_intelex-2025.10.0.dist-info/WHEEL +5 -0
- scikit_learn_intelex-2025.10.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2024 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ==============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pytest
|
|
19
|
+
from numpy.testing import assert_allclose
|
|
20
|
+
|
|
21
|
+
from onedal.basic_statistics.tests.utils import options_and_tests
|
|
22
|
+
from onedal.tests.utils._dataframes_support import (
|
|
23
|
+
_as_numpy,
|
|
24
|
+
_convert_to_dataframe,
|
|
25
|
+
get_dataframes_and_queues,
|
|
26
|
+
)
|
|
27
|
+
from sklearnex import config_context
|
|
28
|
+
from sklearnex.tests.utils.spmd import (
|
|
29
|
+
_generate_statistic_data,
|
|
30
|
+
_get_local_tensor,
|
|
31
|
+
_mpi_libs_and_gpu_available,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.mark.skipif(
|
|
36
|
+
not _mpi_libs_and_gpu_available,
|
|
37
|
+
reason="GPU device and MPI libs required for test",
|
|
38
|
+
)
|
|
39
|
+
@pytest.mark.parametrize(
|
|
40
|
+
"dataframe,queue",
|
|
41
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
42
|
+
)
|
|
43
|
+
@pytest.mark.parametrize("weighted", [True, False])
|
|
44
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
45
|
+
@pytest.mark.mpi
|
|
46
|
+
def test_incremental_basic_statistics_fit_spmd_gold(dataframe, queue, weighted, dtype):
|
|
47
|
+
# Import spmd and batch algo
|
|
48
|
+
from sklearnex.basic_statistics import IncrementalBasicStatistics
|
|
49
|
+
from sklearnex.spmd.basic_statistics import (
|
|
50
|
+
IncrementalBasicStatistics as IncrementalBasicStatistics_SPMD,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Create gold data and process into dpt
|
|
54
|
+
data = np.array(
|
|
55
|
+
[
|
|
56
|
+
[0.0, 0.0, 0.0],
|
|
57
|
+
[0.0, 1.0, 2.0],
|
|
58
|
+
[0.0, 2.0, 4.0],
|
|
59
|
+
[0.0, 3.0, 8.0],
|
|
60
|
+
[0.0, 4.0, 16.0],
|
|
61
|
+
[0.0, 5.0, 32.0],
|
|
62
|
+
[0.0, 6.0, 64.0],
|
|
63
|
+
[0.0, 7.0, 128.0],
|
|
64
|
+
],
|
|
65
|
+
dtype=dtype,
|
|
66
|
+
)
|
|
67
|
+
dpt_data = _convert_to_dataframe(data, sycl_queue=queue, target_df=dataframe)
|
|
68
|
+
|
|
69
|
+
local_dpt_data = _convert_to_dataframe(
|
|
70
|
+
_get_local_tensor(data), sycl_queue=queue, target_df=dataframe
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if weighted:
|
|
74
|
+
# Create weights array containing the weight for each sample in the data
|
|
75
|
+
weights = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], dtype=dtype)
|
|
76
|
+
dpt_weights = _convert_to_dataframe(
|
|
77
|
+
weights, sycl_queue=queue, target_df=dataframe
|
|
78
|
+
)
|
|
79
|
+
local_dpt_weights = _convert_to_dataframe(
|
|
80
|
+
_get_local_tensor(weights), sycl_queue=queue, target_df=dataframe
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# ensure results of batch algo match spmd
|
|
84
|
+
|
|
85
|
+
incbs_spmd = IncrementalBasicStatistics_SPMD().fit(
|
|
86
|
+
local_dpt_data, sample_weight=local_dpt_weights if weighted else None
|
|
87
|
+
)
|
|
88
|
+
incbs = IncrementalBasicStatistics().fit(
|
|
89
|
+
dpt_data, sample_weight=dpt_weights if weighted else None
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
for option in options_and_tests:
|
|
93
|
+
attr = option + "_"
|
|
94
|
+
assert_allclose(
|
|
95
|
+
getattr(incbs_spmd, attr),
|
|
96
|
+
getattr(incbs, attr),
|
|
97
|
+
err_msg=f"Result for {option} is incorrect",
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@pytest.mark.skipif(
|
|
102
|
+
not _mpi_libs_and_gpu_available,
|
|
103
|
+
reason="GPU device and MPI libs required for test",
|
|
104
|
+
)
|
|
105
|
+
@pytest.mark.parametrize(
|
|
106
|
+
"dataframe,queue",
|
|
107
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
108
|
+
)
|
|
109
|
+
@pytest.mark.parametrize("num_blocks", [1, 2])
|
|
110
|
+
@pytest.mark.parametrize("weighted", [True, False])
|
|
111
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
112
|
+
@pytest.mark.mpi
|
|
113
|
+
def test_incremental_basic_statistics_partial_fit_spmd_gold(
|
|
114
|
+
dataframe, queue, num_blocks, weighted, dtype
|
|
115
|
+
):
|
|
116
|
+
# Import spmd and batch algo
|
|
117
|
+
from sklearnex.basic_statistics import IncrementalBasicStatistics
|
|
118
|
+
from sklearnex.spmd.basic_statistics import (
|
|
119
|
+
IncrementalBasicStatistics as IncrementalBasicStatistics_SPMD,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Create gold data and process into dpt
|
|
123
|
+
data = np.array(
|
|
124
|
+
[
|
|
125
|
+
[0.0, 0.0, 0.0],
|
|
126
|
+
[0.0, 1.0, 2.0],
|
|
127
|
+
[0.0, 2.0, 4.0],
|
|
128
|
+
[0.0, 3.0, 8.0],
|
|
129
|
+
[0.0, 4.0, 16.0],
|
|
130
|
+
[0.0, 5.0, 32.0],
|
|
131
|
+
[0.0, 6.0, 64.0],
|
|
132
|
+
[0.0, 7.0, 128.0],
|
|
133
|
+
],
|
|
134
|
+
dtype=dtype,
|
|
135
|
+
)
|
|
136
|
+
dpt_data = _convert_to_dataframe(data, sycl_queue=queue, target_df=dataframe)
|
|
137
|
+
local_data = _get_local_tensor(data)
|
|
138
|
+
split_local_data = np.array_split(local_data, num_blocks)
|
|
139
|
+
|
|
140
|
+
if weighted:
|
|
141
|
+
# Create weights array containing the weight for each sample in the data
|
|
142
|
+
weights = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], dtype=dtype)
|
|
143
|
+
dpt_weights = _convert_to_dataframe(
|
|
144
|
+
weights, sycl_queue=queue, target_df=dataframe
|
|
145
|
+
)
|
|
146
|
+
local_weights = _get_local_tensor(weights)
|
|
147
|
+
split_local_weights = np.array_split(local_weights, num_blocks)
|
|
148
|
+
|
|
149
|
+
incbs_spmd = IncrementalBasicStatistics_SPMD()
|
|
150
|
+
incbs = IncrementalBasicStatistics()
|
|
151
|
+
|
|
152
|
+
for i in range(num_blocks):
|
|
153
|
+
local_dpt_data = _convert_to_dataframe(
|
|
154
|
+
split_local_data[i], sycl_queue=queue, target_df=dataframe
|
|
155
|
+
)
|
|
156
|
+
if weighted:
|
|
157
|
+
local_dpt_weights = _convert_to_dataframe(
|
|
158
|
+
split_local_weights[i], sycl_queue=queue, target_df=dataframe
|
|
159
|
+
)
|
|
160
|
+
incbs_spmd.partial_fit(
|
|
161
|
+
local_dpt_data, sample_weight=local_dpt_weights if weighted else None
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
incbs.fit(dpt_data, sample_weight=dpt_weights if weighted else None)
|
|
165
|
+
|
|
166
|
+
for option in options_and_tests:
|
|
167
|
+
attr = option + "_"
|
|
168
|
+
assert_allclose(
|
|
169
|
+
getattr(incbs_spmd, attr),
|
|
170
|
+
getattr(incbs, attr),
|
|
171
|
+
err_msg=f"Result for {option} is incorrect",
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@pytest.mark.skipif(
|
|
176
|
+
not _mpi_libs_and_gpu_available,
|
|
177
|
+
reason="GPU device and MPI libs required for test",
|
|
178
|
+
)
|
|
179
|
+
@pytest.mark.parametrize(
|
|
180
|
+
"dataframe,queue",
|
|
181
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
182
|
+
)
|
|
183
|
+
@pytest.mark.parametrize("num_blocks", [1, 2])
|
|
184
|
+
@pytest.mark.parametrize("weighted", [True, False])
|
|
185
|
+
@pytest.mark.parametrize("option", options_and_tests.keys())
|
|
186
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
187
|
+
@pytest.mark.mpi
|
|
188
|
+
def test_incremental_basic_statistics_single_option_partial_fit_spmd_gold(
|
|
189
|
+
dataframe, queue, num_blocks, weighted, option, dtype
|
|
190
|
+
):
|
|
191
|
+
# Import spmd and batch algo
|
|
192
|
+
from sklearnex.basic_statistics import IncrementalBasicStatistics
|
|
193
|
+
from sklearnex.spmd.basic_statistics import (
|
|
194
|
+
IncrementalBasicStatistics as IncrementalBasicStatistics_SPMD,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# Create gold data and process into dpt
|
|
198
|
+
data = np.array(
|
|
199
|
+
[
|
|
200
|
+
[0.0, 0.0, 0.0],
|
|
201
|
+
[0.0, 1.0, 2.0],
|
|
202
|
+
[0.0, 2.0, 4.0],
|
|
203
|
+
[0.0, 3.0, 8.0],
|
|
204
|
+
[0.0, 4.0, 16.0],
|
|
205
|
+
[0.0, 5.0, 32.0],
|
|
206
|
+
[0.0, 6.0, 64.0],
|
|
207
|
+
[0.0, 7.0, 128.0],
|
|
208
|
+
],
|
|
209
|
+
dtype=dtype,
|
|
210
|
+
)
|
|
211
|
+
dpt_data = _convert_to_dataframe(data, sycl_queue=queue, target_df=dataframe)
|
|
212
|
+
local_data = _get_local_tensor(data)
|
|
213
|
+
split_local_data = np.array_split(local_data, num_blocks)
|
|
214
|
+
|
|
215
|
+
if weighted:
|
|
216
|
+
# Create weights array containing the weight for each sample in the data
|
|
217
|
+
weights = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], dtype=dtype)
|
|
218
|
+
dpt_weights = _convert_to_dataframe(
|
|
219
|
+
weights, sycl_queue=queue, target_df=dataframe
|
|
220
|
+
)
|
|
221
|
+
local_weights = _get_local_tensor(weights)
|
|
222
|
+
split_local_weights = np.array_split(local_weights, num_blocks)
|
|
223
|
+
|
|
224
|
+
incbs_spmd = IncrementalBasicStatistics_SPMD(result_options=option)
|
|
225
|
+
incbs = IncrementalBasicStatistics(result_options=option)
|
|
226
|
+
|
|
227
|
+
for i in range(num_blocks):
|
|
228
|
+
local_dpt_data = _convert_to_dataframe(
|
|
229
|
+
split_local_data[i], sycl_queue=queue, target_df=dataframe
|
|
230
|
+
)
|
|
231
|
+
if weighted:
|
|
232
|
+
local_dpt_weights = _convert_to_dataframe(
|
|
233
|
+
split_local_weights[i], sycl_queue=queue, target_df=dataframe
|
|
234
|
+
)
|
|
235
|
+
incbs_spmd.partial_fit(
|
|
236
|
+
local_dpt_data, sample_weight=local_dpt_weights if weighted else None
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
incbs.fit(dpt_data, sample_weight=dpt_weights if weighted else None)
|
|
240
|
+
attr = option + "_"
|
|
241
|
+
assert_allclose(getattr(incbs_spmd, attr), getattr(incbs, attr))
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@pytest.mark.skipif(
|
|
245
|
+
not _mpi_libs_and_gpu_available,
|
|
246
|
+
reason="GPU device and MPI libs required for test",
|
|
247
|
+
)
|
|
248
|
+
@pytest.mark.parametrize(
|
|
249
|
+
"dataframe,queue",
|
|
250
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
251
|
+
)
|
|
252
|
+
@pytest.mark.parametrize("num_blocks", [1, 2])
|
|
253
|
+
@pytest.mark.parametrize("weighted", [True, False])
|
|
254
|
+
@pytest.mark.parametrize("n_samples", [100, 10000])
|
|
255
|
+
@pytest.mark.parametrize("n_features", [10, 100])
|
|
256
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
257
|
+
@pytest.mark.parametrize("use_raw_input", [True, False])
|
|
258
|
+
@pytest.mark.mpi
|
|
259
|
+
def test_incremental_basic_statistics_partial_fit_spmd_synthetic(
|
|
260
|
+
dataframe, queue, num_blocks, weighted, n_samples, n_features, dtype, use_raw_input
|
|
261
|
+
):
|
|
262
|
+
# Import spmd and batch algo
|
|
263
|
+
from sklearnex.basic_statistics import IncrementalBasicStatistics
|
|
264
|
+
from sklearnex.spmd.basic_statistics import (
|
|
265
|
+
IncrementalBasicStatistics as IncrementalBasicStatistics_SPMD,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
tol = 2e-3 if dtype == np.float32 else 1e-7
|
|
269
|
+
|
|
270
|
+
# Create gold data and process into dpt
|
|
271
|
+
data = _generate_statistic_data(n_samples, n_features, dtype=dtype)
|
|
272
|
+
local_data = _get_local_tensor(data)
|
|
273
|
+
split_local_data = np.array_split(local_data, num_blocks)
|
|
274
|
+
split_data = np.array_split(data, num_blocks)
|
|
275
|
+
|
|
276
|
+
if weighted:
|
|
277
|
+
# Create weights array containing the weight for each sample in the data
|
|
278
|
+
weights = _generate_statistic_data(n_samples, dtype=dtype)
|
|
279
|
+
local_weights = _get_local_tensor(weights)
|
|
280
|
+
split_local_weights = np.array_split(local_weights, num_blocks)
|
|
281
|
+
split_weights = np.array_split(weights, num_blocks)
|
|
282
|
+
|
|
283
|
+
incbs_spmd = IncrementalBasicStatistics_SPMD()
|
|
284
|
+
incbs = IncrementalBasicStatistics()
|
|
285
|
+
|
|
286
|
+
for i in range(num_blocks):
|
|
287
|
+
local_dpt_data = _convert_to_dataframe(
|
|
288
|
+
split_local_data[i], sycl_queue=queue, target_df=dataframe
|
|
289
|
+
)
|
|
290
|
+
dpt_data = _convert_to_dataframe(
|
|
291
|
+
split_data[i], sycl_queue=queue, target_df=dataframe
|
|
292
|
+
)
|
|
293
|
+
if weighted:
|
|
294
|
+
local_dpt_weights = _convert_to_dataframe(
|
|
295
|
+
split_local_weights[i], sycl_queue=queue, target_df=dataframe
|
|
296
|
+
)
|
|
297
|
+
dpt_weights = _convert_to_dataframe(
|
|
298
|
+
split_weights[i], sycl_queue=queue, target_df=dataframe
|
|
299
|
+
)
|
|
300
|
+
# Configure raw input status for spmd estimator
|
|
301
|
+
with config_context(use_raw_input=use_raw_input):
|
|
302
|
+
incbs_spmd.partial_fit(
|
|
303
|
+
local_dpt_data, sample_weight=local_dpt_weights if weighted else None
|
|
304
|
+
)
|
|
305
|
+
incbs.partial_fit(dpt_data, sample_weight=dpt_weights if weighted else None)
|
|
306
|
+
|
|
307
|
+
for option in options_and_tests:
|
|
308
|
+
attr = option + "_"
|
|
309
|
+
assert_allclose(
|
|
310
|
+
_as_numpy(getattr(incbs_spmd, attr)),
|
|
311
|
+
_as_numpy(getattr(incbs, attr)),
|
|
312
|
+
atol=tol,
|
|
313
|
+
err_msg=f"Result for {option} is incorrect",
|
|
314
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
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 daal4py.sklearn._utils import daal_check_version
|
|
18
|
+
|
|
19
|
+
from .dbscan import DBSCAN
|
|
20
|
+
|
|
21
|
+
if daal_check_version((2023, "P", 200)):
|
|
22
|
+
from .kmeans import KMeans
|
|
23
|
+
|
|
24
|
+
__all__ = ["DBSCAN", "KMeans"]
|
|
25
|
+
else:
|
|
26
|
+
# TODO:
|
|
27
|
+
# update versioning for DBSCAN.
|
|
28
|
+
__all__ = [
|
|
29
|
+
"DBSCAN",
|
|
30
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
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 abc import ABC
|
|
18
|
+
|
|
19
|
+
from onedal.spmd.cluster import DBSCAN as onedal_DBSCAN
|
|
20
|
+
|
|
21
|
+
from ...cluster import DBSCAN as DBSCAN_Batch
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class DBSCAN(DBSCAN_Batch):
|
|
25
|
+
__doc__ = DBSCAN_Batch.__doc__
|
|
26
|
+
_onedal_dbscan = staticmethod(onedal_DBSCAN)
|
|
@@ -0,0 +1,21 @@
|
|
|
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 onedal.spmd.cluster import KMeans
|
|
18
|
+
|
|
19
|
+
# TODO:
|
|
20
|
+
# Currently it uses `onedal` module interface.
|
|
21
|
+
# Add sklearnex dispatching.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2024 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ==============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pytest
|
|
19
|
+
|
|
20
|
+
from onedal.tests.utils._dataframes_support import (
|
|
21
|
+
_convert_to_dataframe,
|
|
22
|
+
get_dataframes_and_queues,
|
|
23
|
+
)
|
|
24
|
+
from sklearnex import config_context
|
|
25
|
+
from sklearnex.tests.utils.spmd import (
|
|
26
|
+
_generate_clustering_data,
|
|
27
|
+
_get_local_tensor,
|
|
28
|
+
_mpi_libs_and_gpu_available,
|
|
29
|
+
_spmd_assert_allclose,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.mark.skipif(
|
|
34
|
+
not _mpi_libs_and_gpu_available,
|
|
35
|
+
reason="GPU device and MPI libs required for test",
|
|
36
|
+
)
|
|
37
|
+
@pytest.mark.parametrize(
|
|
38
|
+
"dataframe,queue",
|
|
39
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
40
|
+
)
|
|
41
|
+
@pytest.mark.mpi
|
|
42
|
+
def test_dbscan_spmd_gold(dataframe, queue):
|
|
43
|
+
# Import spmd and batch algo
|
|
44
|
+
from sklearnex.cluster import DBSCAN as DBSCAN_Batch
|
|
45
|
+
from sklearnex.spmd.cluster import DBSCAN as DBSCAN_SPMD
|
|
46
|
+
|
|
47
|
+
data = np.array([[1, 2], [2, 2], [2, 3], [8, 7], [8, 8], [25, 80]])
|
|
48
|
+
|
|
49
|
+
local_dpt_data = _convert_to_dataframe(
|
|
50
|
+
_get_local_tensor(data), sycl_queue=queue, target_df=dataframe
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Ensure labels from fit of batch algo matches spmd
|
|
54
|
+
spmd_model = DBSCAN_SPMD(eps=3, min_samples=2).fit(local_dpt_data)
|
|
55
|
+
batch_model = DBSCAN_Batch(eps=3, min_samples=2).fit(data)
|
|
56
|
+
|
|
57
|
+
_spmd_assert_allclose(spmd_model.labels_, batch_model.labels_)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@pytest.mark.skipif(
|
|
61
|
+
not _mpi_libs_and_gpu_available,
|
|
62
|
+
reason="GPU device and MPI libs required for test",
|
|
63
|
+
)
|
|
64
|
+
@pytest.mark.parametrize("n_samples", [200, 10000])
|
|
65
|
+
@pytest.mark.parametrize("n_features_and_eps", [(5, 3), (5, 10), (25, 10)])
|
|
66
|
+
@pytest.mark.parametrize("centers", [10, None])
|
|
67
|
+
@pytest.mark.parametrize("min_samples", [2, 5, 15])
|
|
68
|
+
@pytest.mark.parametrize(
|
|
69
|
+
"dataframe,queue",
|
|
70
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
71
|
+
)
|
|
72
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
73
|
+
@pytest.mark.parametrize("use_raw_input", [True, False])
|
|
74
|
+
@pytest.mark.mpi
|
|
75
|
+
def test_dbscan_spmd_synthetic(
|
|
76
|
+
n_samples,
|
|
77
|
+
n_features_and_eps,
|
|
78
|
+
centers,
|
|
79
|
+
min_samples,
|
|
80
|
+
dataframe,
|
|
81
|
+
queue,
|
|
82
|
+
dtype,
|
|
83
|
+
use_raw_input,
|
|
84
|
+
):
|
|
85
|
+
n_features, eps = n_features_and_eps
|
|
86
|
+
# Import spmd and batch algo
|
|
87
|
+
from sklearnex.cluster import DBSCAN as DBSCAN_Batch
|
|
88
|
+
from sklearnex.spmd.cluster import DBSCAN as DBSCAN_SPMD
|
|
89
|
+
|
|
90
|
+
data, _ = _generate_clustering_data(
|
|
91
|
+
n_samples, n_features, centers=centers, dtype=dtype
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
local_dpt_data = _convert_to_dataframe(
|
|
95
|
+
_get_local_tensor(data), sycl_queue=queue, target_df=dataframe
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Ensure labels from fit of batch algo matches spmd
|
|
99
|
+
# Configure raw input status for spmd estimator
|
|
100
|
+
with config_context(use_raw_input=use_raw_input):
|
|
101
|
+
spmd_model = DBSCAN_SPMD(eps=eps, min_samples=min_samples).fit(local_dpt_data)
|
|
102
|
+
batch_model = DBSCAN_Batch(eps=eps, min_samples=min_samples).fit(data)
|
|
103
|
+
|
|
104
|
+
_spmd_assert_allclose(spmd_model.labels_, batch_model.labels_)
|
|
105
|
+
|
|
106
|
+
# Ensure meaningful test setup
|
|
107
|
+
if np.all(batch_model.labels_ == -1):
|
|
108
|
+
raise ValueError("No labels given - try raising epsilon")
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Copyright 2024 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ==============================================================================
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pytest
|
|
19
|
+
from numpy.testing import assert_allclose
|
|
20
|
+
|
|
21
|
+
from onedal.tests.utils._dataframes_support import (
|
|
22
|
+
_convert_to_dataframe,
|
|
23
|
+
get_dataframes_and_queues,
|
|
24
|
+
)
|
|
25
|
+
from sklearnex import config_context
|
|
26
|
+
from sklearnex.tests.utils.spmd import (
|
|
27
|
+
_assert_kmeans_labels_allclose,
|
|
28
|
+
_assert_unordered_allclose,
|
|
29
|
+
_generate_clustering_data,
|
|
30
|
+
_get_local_tensor,
|
|
31
|
+
_mpi_libs_and_gpu_available,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.mark.skipif(
|
|
36
|
+
not _mpi_libs_and_gpu_available,
|
|
37
|
+
reason="GPU device and MPI libs required for test",
|
|
38
|
+
)
|
|
39
|
+
@pytest.mark.parametrize(
|
|
40
|
+
"dataframe,queue",
|
|
41
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
42
|
+
)
|
|
43
|
+
@pytest.mark.mpi
|
|
44
|
+
def test_kmeans_spmd_gold(dataframe, queue):
|
|
45
|
+
# Import spmd and batch algo
|
|
46
|
+
from sklearnex.cluster import KMeans as KMeans_Batch
|
|
47
|
+
from sklearnex.spmd.cluster import KMeans as KMeans_SPMD
|
|
48
|
+
|
|
49
|
+
X_train = np.array(
|
|
50
|
+
[
|
|
51
|
+
[1, 2],
|
|
52
|
+
[2, 2],
|
|
53
|
+
[2, 3],
|
|
54
|
+
[8, 7],
|
|
55
|
+
[8, 8],
|
|
56
|
+
[25, 80],
|
|
57
|
+
[5, 65],
|
|
58
|
+
[2, 8],
|
|
59
|
+
[1, 3],
|
|
60
|
+
[2, 2],
|
|
61
|
+
[1, 3],
|
|
62
|
+
[2, 2],
|
|
63
|
+
],
|
|
64
|
+
dtype=np.float64,
|
|
65
|
+
)
|
|
66
|
+
X_test = np.array([[0, 0], [12, 3], [2, 2], [7, 8]], dtype=np.float64)
|
|
67
|
+
|
|
68
|
+
local_dpt_X_train = _convert_to_dataframe(
|
|
69
|
+
_get_local_tensor(X_train), sycl_queue=queue, target_df=dataframe
|
|
70
|
+
)
|
|
71
|
+
local_dpt_X_test = _convert_to_dataframe(
|
|
72
|
+
_get_local_tensor(X_test), sycl_queue=queue, target_df=dataframe
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Ensure labels from fit of batch algo matches spmd
|
|
76
|
+
spmd_model = KMeans_SPMD(n_clusters=2, random_state=0).fit(local_dpt_X_train)
|
|
77
|
+
batch_model = KMeans_Batch(n_clusters=2, random_state=0).fit(X_train)
|
|
78
|
+
|
|
79
|
+
_assert_unordered_allclose(spmd_model.cluster_centers_, batch_model.cluster_centers_)
|
|
80
|
+
_assert_kmeans_labels_allclose(
|
|
81
|
+
spmd_model.labels_,
|
|
82
|
+
batch_model.labels_,
|
|
83
|
+
spmd_model.cluster_centers_,
|
|
84
|
+
batch_model.cluster_centers_,
|
|
85
|
+
)
|
|
86
|
+
assert_allclose(spmd_model.n_iter_, batch_model.n_iter_, atol=1)
|
|
87
|
+
|
|
88
|
+
# Ensure predictions of batch algo match spmd
|
|
89
|
+
spmd_result = spmd_model.predict(local_dpt_X_test)
|
|
90
|
+
batch_result = batch_model.predict(X_test)
|
|
91
|
+
|
|
92
|
+
_assert_kmeans_labels_allclose(
|
|
93
|
+
spmd_result,
|
|
94
|
+
batch_result,
|
|
95
|
+
spmd_model.cluster_centers_,
|
|
96
|
+
batch_model.cluster_centers_,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@pytest.mark.skipif(
|
|
101
|
+
not _mpi_libs_and_gpu_available,
|
|
102
|
+
reason="GPU device and MPI libs required for test",
|
|
103
|
+
)
|
|
104
|
+
@pytest.mark.parametrize("n_samples", [200, 10000])
|
|
105
|
+
@pytest.mark.parametrize("n_features", [5, 25])
|
|
106
|
+
@pytest.mark.parametrize("n_clusters", [2, 5, 15])
|
|
107
|
+
@pytest.mark.parametrize(
|
|
108
|
+
"dataframe,queue",
|
|
109
|
+
get_dataframes_and_queues(dataframe_filter_="dpnp,dpctl", device_filter_="gpu"),
|
|
110
|
+
)
|
|
111
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
|
112
|
+
@pytest.mark.parametrize("use_raw_input", [True, False])
|
|
113
|
+
@pytest.mark.mpi
|
|
114
|
+
def test_kmeans_spmd_synthetic(
|
|
115
|
+
n_samples, n_features, n_clusters, dataframe, queue, dtype, use_raw_input
|
|
116
|
+
):
|
|
117
|
+
# Import spmd and batch algo
|
|
118
|
+
from sklearnex.cluster import KMeans as KMeans_Batch
|
|
119
|
+
from sklearnex.spmd.cluster import KMeans as KMeans_SPMD
|
|
120
|
+
|
|
121
|
+
# TODO: investigate issues when centers != n_clusters (spmd and batch results don't match for all values of K)
|
|
122
|
+
X_train, X_test = _generate_clustering_data(
|
|
123
|
+
n_samples, n_features, centers=n_clusters, dtype=dtype
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
local_dpt_X_train = _convert_to_dataframe(
|
|
127
|
+
_get_local_tensor(X_train), sycl_queue=queue, target_df=dataframe
|
|
128
|
+
)
|
|
129
|
+
local_dpt_X_test = _convert_to_dataframe(
|
|
130
|
+
_get_local_tensor(X_test), sycl_queue=queue, target_df=dataframe
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
# Validate KMeans init
|
|
134
|
+
spmd_model_init = KMeans_SPMD(n_clusters=n_clusters, max_iter=1, random_state=0).fit(
|
|
135
|
+
local_dpt_X_train
|
|
136
|
+
)
|
|
137
|
+
batch_model_init = KMeans_Batch(
|
|
138
|
+
n_clusters=n_clusters, max_iter=1, random_state=0
|
|
139
|
+
).fit(X_train)
|
|
140
|
+
# TODO: centers do not match up after init
|
|
141
|
+
# _assert_unordered_allclose(spmd_model_init.cluster_centers_, batch_model_init.cluster_centers_)
|
|
142
|
+
|
|
143
|
+
# Ensure labels from fit of batch algo matches spmd, using same init
|
|
144
|
+
spmd_model = KMeans_SPMD(
|
|
145
|
+
n_clusters=n_clusters, init=spmd_model_init.cluster_centers_, random_state=0
|
|
146
|
+
)
|
|
147
|
+
# Configure raw input status for spmd estimator
|
|
148
|
+
with config_context(use_raw_input=use_raw_input):
|
|
149
|
+
spmd_model.fit(local_dpt_X_train)
|
|
150
|
+
batch_model = KMeans_Batch(
|
|
151
|
+
n_clusters=n_clusters, init=spmd_model_init.cluster_centers_, random_state=0
|
|
152
|
+
).fit(X_train)
|
|
153
|
+
|
|
154
|
+
atol = 1e-5 if dtype == np.float32 else 1e-7
|
|
155
|
+
_assert_unordered_allclose(
|
|
156
|
+
spmd_model.cluster_centers_, batch_model.cluster_centers_, atol=atol
|
|
157
|
+
)
|
|
158
|
+
_assert_kmeans_labels_allclose(
|
|
159
|
+
spmd_model.labels_,
|
|
160
|
+
batch_model.labels_,
|
|
161
|
+
spmd_model.cluster_centers_,
|
|
162
|
+
batch_model.cluster_centers_,
|
|
163
|
+
atol=atol,
|
|
164
|
+
)
|
|
165
|
+
# TODO: KMeans iterations are not aligned
|
|
166
|
+
# assert_allclose(spmd_model.n_iter_, batch_model.n_iter_, atol=1)
|
|
167
|
+
|
|
168
|
+
# Ensure predictions of batch algo match spmd
|
|
169
|
+
# Configure raw input status for spmd estimator
|
|
170
|
+
with config_context(use_raw_input=use_raw_input):
|
|
171
|
+
spmd_result = spmd_model.predict(local_dpt_X_test)
|
|
172
|
+
batch_result = batch_model.predict(X_test)
|
|
173
|
+
|
|
174
|
+
_assert_kmeans_labels_allclose(
|
|
175
|
+
spmd_result,
|
|
176
|
+
batch_result,
|
|
177
|
+
spmd_model.cluster_centers_,
|
|
178
|
+
batch_model.cluster_centers_,
|
|
179
|
+
atol=atol,
|
|
180
|
+
)
|