diff --git a/daal4py/sklearn/ensemble/tests/test_decision_forest.py b/daal4py/sklearn/ensemble/tests/test_decision_forest.py index 820bd218b7..cf7dc3374d 100755 --- a/daal4py/sklearn/ensemble/tests/test_decision_forest.py +++ b/daal4py/sklearn/ensemble/tests/test_decision_forest.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -import random import numpy as np import pytest diff --git a/daal4py/sklearn/monkeypatch/tests/_models_info.py b/daal4py/sklearn/monkeypatch/tests/_models_info.py index 6c36fb2527..8bc0821fd0 100644 --- a/daal4py/sklearn/monkeypatch/tests/_models_info.py +++ b/daal4py/sklearn/monkeypatch/tests/_models_info.py @@ -26,7 +26,6 @@ LogisticRegressionCV, Ridge, ) -from sklearn.manifold import TSNE from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor, NearestNeighbors from sklearn.svm import SVC diff --git a/examples/daal4py/bacon_outlier.py b/examples/daal4py/bacon_outlier.py index e2a5303575..3b246b8fea 100644 --- a/examples/daal4py/bacon_outlier.py +++ b/examples/daal4py/bacon_outlier.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/bf_knn_classification.py b/examples/daal4py/bf_knn_classification.py index 3d66108842..aba944c12d 100644 --- a/examples/daal4py/bf_knn_classification.py +++ b/examples/daal4py/bf_knn_classification.py @@ -16,7 +16,6 @@ # daal4py Brute Force KNN example for shared memory systems -import os from pathlib import Path import numpy as np diff --git a/examples/daal4py/cholesky.py b/examples/daal4py/cholesky.py index 21a56e32b0..9c44f5967d 100644 --- a/examples/daal4py/cholesky.py +++ b/examples/daal4py/cholesky.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/correlation_distance.py b/examples/daal4py/correlation_distance.py index dc86db71c0..37848904a0 100644 --- a/examples/daal4py/correlation_distance.py +++ b/examples/daal4py/correlation_distance.py @@ -16,7 +16,6 @@ # daal4py correlation distance example for shared memory systems -import os from pathlib import Path import numpy as np diff --git a/examples/daal4py/cosine_distance.py b/examples/daal4py/cosine_distance.py index 7366eb0c54..e7342d49aa 100644 --- a/examples/daal4py/cosine_distance.py +++ b/examples/daal4py/cosine_distance.py @@ -16,7 +16,6 @@ # daal4py cosine distance example for shared memory systems -import os from pathlib import Path import numpy as np diff --git a/examples/daal4py/dbscan.py b/examples/daal4py/dbscan.py index 78049f7e11..6720d4bf55 100644 --- a/examples/daal4py/dbscan.py +++ b/examples/daal4py/dbscan.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/decision_tree_regression.py b/examples/daal4py/decision_tree_regression.py index 97e34760fe..7734262791 100644 --- a/examples/daal4py/decision_tree_regression.py +++ b/examples/daal4py/decision_tree_regression.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/elastic_net.py b/examples/daal4py/elastic_net.py index 14ec9d0434..7ddb4f54ac 100644 --- a/examples/daal4py/elastic_net.py +++ b/examples/daal4py/elastic_net.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/em_gmm.py b/examples/daal4py/em_gmm.py index 8f6b230314..de87c6fcb9 100644 --- a/examples/daal4py/em_gmm.py +++ b/examples/daal4py/em_gmm.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/implicit_als.py b/examples/daal4py/implicit_als.py index 36f612a576..e0088d592f 100644 --- a/examples/daal4py/implicit_als.py +++ b/examples/daal4py/implicit_als.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/kdtree_knn_classification.py b/examples/daal4py/kdtree_knn_classification.py index db13f1c672..8ba6a93a61 100644 --- a/examples/daal4py/kdtree_knn_classification.py +++ b/examples/daal4py/kdtree_knn_classification.py @@ -16,7 +16,6 @@ # daal4py KD-Tree KNN example for shared memory systems -import os from pathlib import Path import numpy as np diff --git a/examples/daal4py/kmeans.py b/examples/daal4py/kmeans.py index cf68fddef8..3e65e37c27 100644 --- a/examples/daal4py/kmeans.py +++ b/examples/daal4py/kmeans.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/lasso_regression.py b/examples/daal4py/lasso_regression.py index 8e947e9edd..7850257c3b 100644 --- a/examples/daal4py/lasso_regression.py +++ b/examples/daal4py/lasso_regression.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/linear_regression.py b/examples/daal4py/linear_regression.py index 506d2b9752..7f6d6955c7 100644 --- a/examples/daal4py/linear_regression.py +++ b/examples/daal4py/linear_regression.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/log_reg_binary_dense.py b/examples/daal4py/log_reg_binary_dense.py index 665ea0271b..43e619ab80 100644 --- a/examples/daal4py/log_reg_binary_dense.py +++ b/examples/daal4py/log_reg_binary_dense.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/low_order_moms_dense.py b/examples/daal4py/low_order_moms_dense.py index 373c25c3a0..da4f14b9e9 100644 --- a/examples/daal4py/low_order_moms_dense.py +++ b/examples/daal4py/low_order_moms_dense.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/multivariate_outlier.py b/examples/daal4py/multivariate_outlier.py index 6e0c993b88..fa34a7ad80 100644 --- a/examples/daal4py/multivariate_outlier.py +++ b/examples/daal4py/multivariate_outlier.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/naive_bayes.py b/examples/daal4py/naive_bayes.py index d2761f55d8..8e05b35e18 100644 --- a/examples/daal4py/naive_bayes.py +++ b/examples/daal4py/naive_bayes.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/pivoted_qr.py b/examples/daal4py/pivoted_qr.py index 370feb00a0..6df91f5869 100644 --- a/examples/daal4py/pivoted_qr.py +++ b/examples/daal4py/pivoted_qr.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/ridge_regression.py b/examples/daal4py/ridge_regression.py index feb9363506..973d421111 100644 --- a/examples/daal4py/ridge_regression.py +++ b/examples/daal4py/ridge_regression.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/svm_multiclass.py b/examples/daal4py/svm_multiclass.py index 996eb18d91..0450351f1b 100644 --- a/examples/daal4py/svm_multiclass.py +++ b/examples/daal4py/svm_multiclass.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/daal4py/univariate_outlier.py b/examples/daal4py/univariate_outlier.py index 0ad2a4ba19..349caf0ef5 100644 --- a/examples/daal4py/univariate_outlier.py +++ b/examples/daal4py/univariate_outlier.py @@ -18,7 +18,6 @@ from pathlib import Path -import numpy as np from readcsv import pd_read_csv import daal4py as d4p diff --git a/examples/sklearnex/dbscan_array_api.py b/examples/sklearnex/dbscan_array_api.py index 90584bd152..c5b1c9b510 100644 --- a/examples/sklearnex/dbscan_array_api.py +++ b/examples/sklearnex/dbscan_array_api.py @@ -16,7 +16,7 @@ import array_api_strict -from sklearnex import config_context, patch_sklearn +from sklearnex import patch_sklearn patch_sklearn() diff --git a/examples/sklearnex/dbscan_spmd.py b/examples/sklearnex/dbscan_spmd.py index e67e7a7cbb..c390adc405 100644 --- a/examples/sklearnex/dbscan_spmd.py +++ b/examples/sklearnex/dbscan_spmd.py @@ -18,10 +18,8 @@ # run like this: # mpirun -n 4 python ./dbscan_spmd.py -from warnings import warn import dpctl.tensor as dpt -import numpy as np from dpctl import SyclQueue from mpi4py import MPI from sklearn.datasets import load_digits diff --git a/examples/sklearnex/kmeans_spmd.py b/examples/sklearnex/kmeans_spmd.py index 38d2364b01..eb4c8970ce 100644 --- a/examples/sklearnex/kmeans_spmd.py +++ b/examples/sklearnex/kmeans_spmd.py @@ -14,10 +14,8 @@ # limitations under the License. # ============================================================================== -from warnings import warn import dpctl.tensor as dpt -import numpy as np from dpctl import SyclQueue from mpi4py import MPI from sklearn.datasets import load_digits diff --git a/examples/sklearnex/knn_bf_classification_dpnp.py b/examples/sklearnex/knn_bf_classification_dpnp.py index 7a777abf3f..44422201d9 100644 --- a/examples/sklearnex/knn_bf_classification_dpnp.py +++ b/examples/sklearnex/knn_bf_classification_dpnp.py @@ -19,7 +19,6 @@ import dpctl import dpnp -import numpy as np from sklearn.datasets import make_classification from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split diff --git a/examples/sklearnex/knn_bf_classification_spmd.py b/examples/sklearnex/knn_bf_classification_spmd.py index 915747eb21..449439d43d 100644 --- a/examples/sklearnex/knn_bf_classification_spmd.py +++ b/examples/sklearnex/knn_bf_classification_spmd.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -from warnings import warn import dpctl import dpctl.tensor as dpt diff --git a/examples/sklearnex/knn_bf_regression_spmd.py b/examples/sklearnex/knn_bf_regression_spmd.py index 28ce112290..dd5fa12059 100644 --- a/examples/sklearnex/knn_bf_regression_spmd.py +++ b/examples/sklearnex/knn_bf_regression_spmd.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -from warnings import warn import dpctl import dpctl.tensor as dpt diff --git a/examples/sklearnex/logistic_regression_spmd.py b/examples/sklearnex/logistic_regression_spmd.py index 0799ae61de..24d56d1bcf 100644 --- a/examples/sklearnex/logistic_regression_spmd.py +++ b/examples/sklearnex/logistic_regression_spmd.py @@ -14,14 +14,12 @@ # limitations under the License. # ============================================================================== -from warnings import warn import dpctl import dpctl.tensor as dpt import numpy as np from mpi4py import MPI from scipy.special import expit -from sklearn.datasets import make_classification from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split diff --git a/examples/sklearnex/n_jobs.py b/examples/sklearnex/n_jobs.py index 54694ecdc1..3b00a6345c 100644 --- a/examples/sklearnex/n_jobs.py +++ b/examples/sklearnex/n_jobs.py @@ -25,7 +25,6 @@ patch_sklearn() # Remaining non modified scikit-learn code -import numpy as np from sklearn.datasets import make_blobs from sklearn.preprocessing import StandardScaler diff --git a/examples/sklearnex/random_forest_classifier_dpctl.py b/examples/sklearnex/random_forest_classifier_dpctl.py index 061b9e0473..1ea610f708 100644 --- a/examples/sklearnex/random_forest_classifier_dpctl.py +++ b/examples/sklearnex/random_forest_classifier_dpctl.py @@ -19,7 +19,6 @@ import dpctl import dpctl.tensor as dpt -import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split diff --git a/examples/sklearnex/random_forest_regressor_dpnp.py b/examples/sklearnex/random_forest_regressor_dpnp.py index 5b8b6bc616..ff8a8b9b0d 100644 --- a/examples/sklearnex/random_forest_regressor_dpnp.py +++ b/examples/sklearnex/random_forest_regressor_dpnp.py @@ -18,7 +18,6 @@ # python ./random_forest_regressor_dpnp_batch.py import dpnp -import numpy as np from sklearn.datasets import make_regression from sklearn.model_selection import train_test_split diff --git a/generator/gen_daal4py.py b/generator/gen_daal4py.py index 13a2ac7669..cb26e147ec 100755 --- a/generator/gen_daal4py.py +++ b/generator/gen_daal4py.py @@ -31,7 +31,6 @@ from os.path import join as jp from shutil import copytree, rmtree from subprocess import call -from sys import platform from .format import mk_var from .parse import parse_header, parse_version diff --git a/onedal/basic_statistics/incremental_basic_statistics.py b/onedal/basic_statistics/incremental_basic_statistics.py index 4375d7bbc0..3d3a79f6ba 100644 --- a/onedal/basic_statistics/incremental_basic_statistics.py +++ b/onedal/basic_statistics/incremental_basic_statistics.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -from abc import abstractmethod import numpy as np diff --git a/onedal/cluster/dbscan.py b/onedal/cluster/dbscan.py index c89f7a5ba8..6c01f36136 100644 --- a/onedal/cluster/dbscan.py +++ b/onedal/cluster/dbscan.py @@ -14,7 +14,6 @@ # limitations under the License. # =============================================================================== -from abc import abstractmethod import numpy as np diff --git a/onedal/cluster/kmeans.py b/onedal/cluster/kmeans.py index c301919b1c..2902e2e601 100644 --- a/onedal/cluster/kmeans.py +++ b/onedal/cluster/kmeans.py @@ -16,8 +16,7 @@ import logging import warnings -from abc import ABC, abstractmethod -from types import ModuleType +from abc import ABC import numpy as np diff --git a/onedal/cluster/tests/test_dbscan.py b/onedal/cluster/tests/test_dbscan.py index d309cc8767..530cdd78b5 100644 --- a/onedal/cluster/tests/test_dbscan.py +++ b/onedal/cluster/tests/test_dbscan.py @@ -17,7 +17,6 @@ import numpy as np import pytest from sklearn.cluster import DBSCAN as DBSCAN_SKLEARN -from sklearn.cluster.tests.common import generate_clustered_data from onedal.cluster import DBSCAN as ONEDAL_DBSCAN from onedal.tests.utils._device_selection import get_queues diff --git a/onedal/common/_policy.py b/onedal/common/_policy.py deleted file mode 100644 index 0d7d8ca6a3..0000000000 --- a/onedal/common/_policy.py +++ /dev/null @@ -1,55 +0,0 @@ -# ============================================================================== -# Copyright 2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import sys - -from onedal import _backend, _is_dpc_backend - - -def _get_policy(queue, *data): - data_queue = _get_queue(*data) - if _is_dpc_backend: - if queue is None: - if data_queue is None: - return _HostInteropPolicy() - return _DataParallelInteropPolicy(data_queue) - return _DataParallelInteropPolicy(queue) - else: - if not (data_queue is None and queue is None): - raise RuntimeError( - "Operation using the requested SYCL queue requires the DPC backend" - ) - return _HostInteropPolicy() - - -def _get_queue(*data): - if len(data) > 0 and hasattr(data[0], "__sycl_usm_array_interface__"): - # Assume that all data reside on the same device - return data[0].__sycl_usm_array_interface__["syclobj"] - return None - - -class _HostInteropPolicy(_backend.host_policy): - def __init__(self): - super().__init__() - - -if _is_dpc_backend: - - class _DataParallelInteropPolicy(_backend.data_parallel_policy): - def __init__(self, queue): - self._queue = queue - super().__init__(self._queue) diff --git a/onedal/covariance/incremental_covariance.py b/onedal/covariance/incremental_covariance.py index 94f42fc8bc..1c974790a1 100644 --- a/onedal/covariance/incremental_covariance.py +++ b/onedal/covariance/incremental_covariance.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # =============================================================================== -from abc import abstractmethod import numpy as np diff --git a/onedal/decomposition/incremental_pca.py b/onedal/decomposition/incremental_pca.py index 48eb0554f7..1764021ab9 100644 --- a/onedal/decomposition/incremental_pca.py +++ b/onedal/decomposition/incremental_pca.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -from abc import abstractmethod import numpy as np diff --git a/onedal/decomposition/pca.py b/onedal/decomposition/pca.py index 58257643a8..b4311b7f72 100644 --- a/onedal/decomposition/pca.py +++ b/onedal/decomposition/pca.py @@ -15,7 +15,7 @@ # ============================================================================== import numbers -from abc import ABCMeta, abstractmethod +from abc import ABCMeta import numpy as np from sklearn.decomposition._pca import _infer_dimension @@ -179,9 +179,8 @@ def fit(self, X, y=None, queue=None): self.n_samples_ = n_samples self.n_features_ = n_features - U = None - S = self.singular_values_ - Vt = self.components_ + self.singular_values_ + self.components_ n_components = self._resolve_n_components_for_result(X.shape) self.n_components_ = n_components diff --git a/onedal/linear_model/incremental_linear_model.py b/onedal/linear_model/incremental_linear_model.py index 9592a848cb..898b41d045 100644 --- a/onedal/linear_model/incremental_linear_model.py +++ b/onedal/linear_model/incremental_linear_model.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -from abc import abstractmethod import numpy as np diff --git a/onedal/spmd/decomposition/incremental_pca.py b/onedal/spmd/decomposition/incremental_pca.py index cdbcdb2235..587537a789 100644 --- a/onedal/spmd/decomposition/incremental_pca.py +++ b/onedal/spmd/decomposition/incremental_pca.py @@ -14,7 +14,8 @@ # limitations under the License. # ============================================================================== -from ...common._backend import DefaultPolicyOverride, bind_spmd_backend +from onedal.common._backend import DefaultPolicyOverride, bind_spmd_backend + from ...decomposition import IncrementalPCA as base_IncrementalPCA diff --git a/onedal/spmd/linear_model/incremental_linear_model.py b/onedal/spmd/linear_model/incremental_linear_model.py index 6470173a9c..faf55fc5a9 100644 --- a/onedal/spmd/linear_model/incremental_linear_model.py +++ b/onedal/spmd/linear_model/incremental_linear_model.py @@ -15,7 +15,8 @@ # ============================================================================== -from ...common._backend import DefaultPolicyOverride, bind_spmd_backend +from onedal.common._backend import DefaultPolicyOverride, bind_spmd_backend + from ...linear_model import ( IncrementalLinearRegression as base_IncrementalLinearRegression, ) diff --git a/onedal/svm/tests/test_svc.py b/onedal/svm/tests/test_svc.py index 9f7eaa4810..fdef467c52 100644 --- a/onedal/svm/tests/test_svc.py +++ b/onedal/svm/tests/test_svc.py @@ -16,7 +16,6 @@ import numpy as np import pytest -import sklearn.utils.estimator_checks from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn import datasets from sklearn.datasets import make_blobs diff --git a/sklearnex/cluster/tests/test_kmeans.py b/sklearnex/cluster/tests/test_kmeans.py index eb458a6748..08e4a8a06f 100755 --- a/sklearnex/cluster/tests/test_kmeans.py +++ b/sklearnex/cluster/tests/test_kmeans.py @@ -27,7 +27,6 @@ get_dataframes_and_queues, get_queues, ) -from sklearnex import config_context from sklearnex.tests.utils import _IS_INTEL diff --git a/sklearnex/covariance/incremental_covariance.py b/sklearnex/covariance/incremental_covariance.py index e5d2e5ed98..df781b320f 100644 --- a/sklearnex/covariance/incremental_covariance.py +++ b/sklearnex/covariance/incremental_covariance.py @@ -30,10 +30,9 @@ from onedal.covariance import ( IncrementalEmpiricalCovariance as onedal_IncrementalEmpiricalCovariance, ) -from sklearnex import config_context from .._device_offload import dispatch, wrap_output_data -from .._utils import IntelEstimator, PatchingConditionsChain, register_hyperparameters +from .._utils import IntelEstimator, PatchingConditionsChain from ..metrics import pairwise_distances from ..utils._array_api import get_namespace diff --git a/sklearnex/linear_model/linear.py b/sklearnex/linear_model/linear.py index 7dc8c5f9f0..15371b2db6 100644 --- a/sklearnex/linear_model/linear.py +++ b/sklearnex/linear_model/linear.py @@ -15,7 +15,6 @@ # =============================================================================== import logging -from abc import ABC import numpy as np from sklearn.linear_model import LinearRegression as _sklearn_LinearRegression diff --git a/sklearnex/linear_model/tests/test_linear.py b/sklearnex/linear_model/tests/test_linear.py index d1369d0edb..fe60c0d049 100644 --- a/sklearnex/linear_model/tests/test_linear.py +++ b/sklearnex/linear_model/tests/test_linear.py @@ -30,7 +30,6 @@ _convert_to_dataframe, get_dataframes_and_queues, ) -from sklearnex.tests.utils import _IS_INTEL @pytest.mark.parametrize("dataframe,queue", get_dataframes_and_queues()) diff --git a/sklearnex/linear_model/tests/test_logreg.py b/sklearnex/linear_model/tests/test_logreg.py index 65c7ea5d0f..5299d9e381 100755 --- a/sklearnex/linear_model/tests/test_logreg.py +++ b/sklearnex/linear_model/tests/test_logreg.py @@ -16,7 +16,7 @@ import numpy as np import pytest -from numpy.testing import assert_allclose, assert_array_equal +from numpy.testing import assert_allclose from scipy.sparse import csr_matrix from sklearn.datasets import load_breast_cancer, load_iris, make_classification from sklearn.metrics import accuracy_score diff --git a/sklearnex/manifold/tests/test_tsne.py b/sklearnex/manifold/tests/test_tsne.py index 2ba8c64cdc..dca2172014 100755 --- a/sklearnex/manifold/tests/test_tsne.py +++ b/sklearnex/manifold/tests/test_tsne.py @@ -15,7 +15,6 @@ # =============================================================================== import numpy as np -from numpy.testing import assert_allclose def test_sklearnex_import(): diff --git a/sklearnex/neighbors/knn_classification.py b/sklearnex/neighbors/knn_classification.py index 3b9871b4cf..57b0fa11a7 100755 --- a/sklearnex/neighbors/knn_classification.py +++ b/sklearnex/neighbors/knn_classification.py @@ -18,7 +18,6 @@ from sklearn.neighbors._classification import ( KNeighborsClassifier as _sklearn_KNeighborsClassifier, ) -from sklearn.neighbors._unsupervised import NearestNeighbors as _sklearn_NearestNeighbors from sklearn.utils.validation import _deprecate_positional_args, check_is_fitted from daal4py.sklearn._n_jobs_support import control_n_jobs diff --git a/sklearnex/spmd/ensemble/tests/test_forest_spmd.py b/sklearnex/spmd/ensemble/tests/test_forest_spmd.py index 9429b61189..d84a32fe69 100644 --- a/sklearnex/spmd/ensemble/tests/test_forest_spmd.py +++ b/sklearnex/spmd/ensemble/tests/test_forest_spmd.py @@ -16,7 +16,6 @@ import numpy as np import pytest -from sklearn.datasets import make_regression from onedal.tests.utils._dataframes_support import ( _convert_to_dataframe, @@ -231,9 +230,6 @@ def test_rfreg_spmd_synthetic( ): # Import spmd and batch algo from sklearnex.ensemble import RandomForestRegressor as RandomForestRegressor_Batch - from sklearnex.spmd.ensemble import ( - RandomForestRegressor as RandomForestRegressor_SPMD, - ) # Generate data and convert to dataframe X_train, X_test, y_train, _ = _generate_regression_data( diff --git a/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py b/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py index 24112a362e..7cebd3c57e 100644 --- a/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py +++ b/sklearnex/spmd/neighbors/tests/test_neighbors_spmd.py @@ -16,7 +16,6 @@ import numpy as np import pytest -from numpy.testing import assert_allclose from onedal.tests.utils._dataframes_support import ( _convert_to_dataframe, diff --git a/sklearnex/svm/__init__.py b/sklearnex/svm/__init__.py index cf43ad4e37..48cdd0ff95 100755 --- a/sklearnex/svm/__init__.py +++ b/sklearnex/svm/__init__.py @@ -16,14 +16,14 @@ from .._utils import get_sklearnex_version -if get_sklearnex_version((2021, "P", 300)): +if not get_sklearnex_version((2021, "P", 300)): + from daal4py.sklearn.svm import SVC + + __all__ = ["SVC"] +else: from .nusvc import NuSVC from .nusvr import NuSVR from .svc import SVC from .svr import SVR __all__ = ["SVR", "SVC", "NuSVC", "NuSVR"] -else: - from daal4py.sklearn.svm import SVC - - __all__ = ["SVC"] diff --git a/sklearnex/tests/test_n_jobs_support.py b/sklearnex/tests/test_n_jobs_support.py index 107f53fbeb..6b187aee43 100644 --- a/sklearnex/tests/test_n_jobs_support.py +++ b/sklearnex/tests/test_n_jobs_support.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -import inspect import logging from multiprocessing import cpu_count @@ -22,13 +21,7 @@ from sklearn.datasets import make_classification from sklearn.exceptions import NotFittedError -from sklearnex.tests.utils import ( - PATCHED_MODELS, - SPECIAL_INSTANCES, - call_method, - gen_dataset, - gen_models_info, -) +from sklearnex.tests.utils import PATCHED_MODELS, SPECIAL_INSTANCES, call_method _X, _Y = make_classification(n_samples=40, n_features=4, random_state=42) @@ -100,7 +93,7 @@ def test_n_jobs_support(estimator, n_jobs, caplog): continue try: call_method(est, method_name, _X, _Y) - except (NotFittedError, AttributeError) as e: + except (NotFittedError, AttributeError): # handle sklearns available_if wrapper continue diff --git a/sklearnex/tests/test_patching.py b/sklearnex/tests/test_patching.py index 897f19172d..ae6b521ed6 100755 --- a/sklearnex/tests/test_patching.py +++ b/sklearnex/tests/test_patching.py @@ -18,7 +18,6 @@ import importlib import inspect import logging -import os import re import sys from inspect import signature diff --git a/sklearnex/tests/test_run_to_run_stability.py b/sklearnex/tests/test_run_to_run_stability.py index 7d4f96aee0..e630ef7ff9 100755 --- a/sklearnex/tests/test_run_to_run_stability.py +++ b/sklearnex/tests/test_run_to_run_stability.py @@ -22,7 +22,6 @@ import numpy as np import pytest from numpy.testing import assert_allclose -from scipy import sparse from sklearn.datasets import ( load_breast_cancer, load_diabetes, diff --git a/tests/run_examples.py b/tests/run_examples.py index ba84c26968..a8119c5fc4 100755 --- a/tests/run_examples.py +++ b/tests/run_examples.py @@ -25,7 +25,6 @@ from os.path import join as jp from time import gmtime, strftime -from daal4py import __has_dist__ from daal4py.sklearn._utils import get_daal_version from onedal.utils._dpep_helpers import dpctl_available diff --git a/tests/test_model_builders.py b/tests/test_model_builders.py index b7a40c1e61..2bd3d96b65 100644 --- a/tests/test_model_builders.py +++ b/tests/test_model_builders.py @@ -17,7 +17,6 @@ import contextlib import unittest import warnings -from datetime import datetime import lightgbm as lgbm import numpy as np diff --git a/tests/test_printing.py b/tests/test_printing.py index ce9f55df0e..b985dafbe1 100644 --- a/tests/test_printing.py +++ b/tests/test_printing.py @@ -14,7 +14,6 @@ # limitations under the License. # ============================================================================== -import re import unittest import numpy as np