Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions python/cuml/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ exclude =
extend-ignore =
# handled by black
E501, W503, E203
# imported but unused
F401
# redefinition of unused
F811

Expand Down
6 changes: 3 additions & 3 deletions python/cuml/cuml/benchmark/algorithms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,13 +54,13 @@
import cuml.decomposition
import cuml.experimental
import cuml.naive_bayes
from cuml.dask import (
from cuml.dask import ( # noqa: F401
neighbors,
cluster,
manifold,
decomposition,
linear_model,
) # noqa: F401
)
from cuml.internals.import_utils import has_hdbscan, has_umap
from cuml.internals.safe_imports import cpu_only_import

Expand Down
3 changes: 0 additions & 3 deletions python/cuml/cuml/benchmark/bench_helper_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def _training_data_to_numpy(X, y):

def _build_fil_classifier(m, data, args, tmpdir):
"""Setup function for FIL classification benchmarking"""
from cuml.internals.import_utils import has_xgboost

train_data, train_label = _training_data_to_numpy(data[0], data[1])

Expand Down Expand Up @@ -185,7 +184,6 @@ def _build_optimized_fil_classifier(m, data, args, tmpdir):
"""Setup function for FIL classification benchmarking with optimal
parameters"""
with using_device_type("gpu"):
from cuml.internals.import_utils import has_xgboost

train_data, train_label = _training_data_to_numpy(data[0], data[1])

Expand Down Expand Up @@ -376,7 +374,6 @@ def predict(self, X):

def _build_gtil_classifier(m, data, args, tmpdir):
"""Setup function for treelite classification benchmarking"""
from cuml.internals.import_utils import has_xgboost

max_depth = args["max_depth"]
num_rounds = args["num_rounds"]
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/benchmark/datagen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,7 +44,6 @@
from cuml.internals.safe_imports import cpu_only_import
import os
import functools
import gzip
from cuml.internals.safe_imports import gpu_only_import

cudf = gpu_only_import("cudf")
Expand Down
10 changes: 2 additions & 8 deletions python/cuml/cuml/dask/linear_model/logistic_regression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,19 +13,13 @@
# limitations under the License.
#

from cuml.dask.common.base import BaseEstimator
from cuml.dask.common.base import DelayedPredictionMixin
from cuml.dask.common.base import mnmg_import
from cuml.dask.common.base import SyncFitMixinLinearModel
from cuml.dask.linear_model import LinearRegression
from raft_dask.common.comms import get_raft_comm_state
from dask.distributed import get_worker

from cuml.common.sparse_utils import is_sparse, has_scipy
from cuml.dask.common import parts_to_ranks
from cuml.dask.common.input_utils import DistributedDataHandler, concatenate
from raft_dask.common.comms import Comms
from cuml.dask.common.utils import wait_and_raise_from_futures
from cuml.dask.common.input_utils import concatenate
from cuml.internals.safe_imports import cpu_only_import
from cuml.internals.safe_imports import gpu_only_import

Expand Down
1 change: 0 additions & 1 deletion python/cuml/cuml/internals/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import copy
import operator
import pickle
from typing import Tuple

from cuml.internals.global_settings import GlobalSettings
Expand Down
6 changes: 3 additions & 3 deletions python/cuml/cuml/internals/available_devices.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
# limitations under the License.
#
from cuml.internals.device_support import GPU_ENABLED
from cuml.internals.safe_imports import gpu_only_import_from, UnavailableError
from cuml.internals.safe_imports import UnavailableError


from functools import cache
Expand All @@ -26,7 +26,7 @@ def gpu_available_no_context_creation():
creating a CUDA context. We check for CuPy presence as a proxy of that.
"""
try:
import cupy
import cupy # noqa: F401

return True
except ImportError:
Expand Down
5 changes: 1 addition & 4 deletions python/cuml/cuml/internals/base_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
#

from inspect import Parameter, signature
import typing

from cuml.internals.api_decorators import (
api_base_return_generic,
Expand All @@ -25,8 +24,6 @@
api_return_any,
_deprecate_pos_args,
)
from cuml.internals.array import CumlArray
from cuml.internals.array_sparse import SparseCumlArray
from cuml.internals.base_return_types import _get_base_return_type
from cuml.internals.constants import CUML_WRAPPED_FLAG

Expand Down
4 changes: 1 addition & 3 deletions python/cuml/cuml/internals/safe_imports.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,13 +17,11 @@

import importlib
import traceback
import warnings

from contextlib import contextmanager
from cuml.internals.device_support import (
CPU_ENABLED,
GPU_ENABLED,
MIN_SKLEARN_VERSION,
MIN_SKLEARN_PRESENT,
)
from cuml.internals import logger
Expand Down
1 change: 0 additions & 1 deletion python/cuml/cuml/model_selection/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
determine_df_obj_type,
)
from cuml.internals.output_utils import output_to_df_obj_like
from cuml.internals.mem_type import MemoryType
from cuml.internals.array import array_to_memory_order, CumlArray
from cuml.internals.safe_imports import (
cpu_only_import,
Expand Down
5 changes: 0 additions & 5 deletions python/cuml/cuml/multiclass/multiclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
input_to_host_array,
input_to_host_array_with_sparse_support,
)
from cuml.internals.input_utils import (
input_to_cupy_array,
determine_array_type_full,
)
from cuml.internals.array_sparse import SparseCumlArray
from cuml.internals import _deprecate_pos_args


Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/preprocessing/LabelEncoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

from cuml import Base
from cuml._thirdparty.sklearn.utils.validation import check_is_fitted
from cuml.common.exceptions import NotFittedError
from cuml.internals.safe_imports import (
cpu_only_import,
cpu_only_import_from,
gpu_only_import,
)

Expand Down
2 changes: 1 addition & 1 deletion python/cuml/cuml/preprocessing/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
#
import warnings
from typing import List, Optional, TypeVar
from typing import Optional

import cuml.internals.logger as logger
from cudf import DataFrame, Series
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import ElasticNet
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.metrics import r2_score
from sklearn.preprocessing import StandardScaler


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@

import pytest
import numpy as np
from sklearn.datasets import make_blobs, make_moons
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
import hdbscan
from hdbscan import validity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,6 @@
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
#

import pytest
import numpy as np
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#

import pytest
import numpy as np
from sklearn.datasets import make_regression
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import r2_score
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.metrics import r2_score
from sklearn.preprocessing import StandardScaler


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,6 @@
import numpy as np
from sklearn.datasets import make_classification
from sklearn.decomposition import TruncatedSVD
from sklearn.preprocessing import StandardScaler
from scipy.sparse import csr_matrix


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#

import pytest
import numpy as np
from sklearn.datasets import make_swiss_roll
from umap import UMAP
from sklearn.manifold import trustworthiness
Expand Down
14 changes: 3 additions & 11 deletions python/cuml/cuml/tests/accel/test_basic_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest
import numpy as np
from sklearn import clone, cluster
import cuml
from cuml.internals.global_settings import GlobalSettings
from sklearn import clone
import cuml # noqa: F401
from cuml.internals.global_settings import GlobalSettings # noqa: F401
from cuml.internals.safe_imports import gpu_only_import
from sklearn.datasets import make_classification, make_regression, make_blobs
from sklearn.linear_model import (
Expand All @@ -34,13 +33,6 @@
KNeighborsClassifier,
KNeighborsRegressor,
)
from sklearn.metrics import (
mean_squared_error,
r2_score,
adjusted_rand_score,
accuracy_score,
)
from scipy.sparse import random as sparse_random

cp = gpu_only_import("cupy")

Expand Down
5 changes: 0 additions & 5 deletions python/cuml/cuml/tests/accel/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@
Ridge,
Lasso,
)
from sklearn.manifold import TSNE
from sklearn.neighbors import (
NearestNeighbors,
KNeighborsClassifier,
KNeighborsRegressor,
)
from sklearn.preprocessing import Normalizer
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.datasets import make_classification, make_regression
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, mean_squared_error
from umap import UMAP
import hdbscan
import numpy as np
import scipy as sp


Expand Down
4 changes: 1 addition & 3 deletions python/cuml/cuml/tests/accel/test_sparse_dispatch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,8 +30,6 @@
)
from sklearn.neighbors import (
NearestNeighbors,
KNeighborsClassifier,
KNeighborsRegressor,
)
from sklearn.base import is_classifier, is_regressor
from hdbscan import HDBSCAN
Expand Down
Loading