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
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/agglomerative.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AgglomerativeClustering(ClusterMixin, CMajorInputTagMixin, Base):

@generate_docstring()
@mlfunc(set_input_type=True)
def fit(self, X, y=None, *, convert_dtype="deprecated") -> "AgglomerativeClustering":
def fit(self, X, y=None) -> "AgglomerativeClustering":
"""
Fit the hierarchical clustering from features.
"""
Expand All @@ -146,7 +146,6 @@ class AgglomerativeClustering(ClusterMixin, CMajorInputTagMixin, Base):
X,
order="C",
dtype="float32",
convert_dtype=convert_dtype,
ensure_min_samples=2,
reset=True,
)
Expand Down
10 changes: 1 addition & 9 deletions python/cuml/cuml/cluster/dbscan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ class DBSCAN(InteropMixin,
sample_weight=None,
*,
out_dtype="int32",
convert_dtype="deprecated"
) -> "DBSCAN":
"""
Perform DBSCAN clustering from features.
Expand All @@ -327,7 +326,6 @@ class DBSCAN(InteropMixin,
X,
sample_weight=sample_weight,
dtype=("float32", "float64"),
convert_dtype=convert_dtype,
order="C",
return_index=True,
reset=True,
Expand Down Expand Up @@ -482,7 +480,6 @@ class DBSCAN(InteropMixin,
sample_weight=None,
*,
out_dtype="int32",
convert_dtype="deprecated",
):
"""
Performs clustering on X and returns cluster labels.
Expand All @@ -499,10 +496,5 @@ class DBSCAN(InteropMixin,
negative weight may inhibit its eps-neighbor from being core.
default: None (which is equivalent to weight 1 for all samples).
"""
self.fit(
X,
sample_weight=sample_weight,
out_dtype=out_dtype,
convert_dtype=convert_dtype
)
self.fit(X, sample_weight=sample_weight, out_dtype=out_dtype)
return self.labels_
14 changes: 3 additions & 11 deletions python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ class HDBSCAN(InteropMixin, ClusterMixin, CMajorInputTagMixin, Base):

@generate_docstring()
@mlfunc(set_input_type=True)
def fit(self, X, y=None, *, convert_dtype="deprecated") -> "HDBSCAN":
def fit(self, X, y=None) -> "HDBSCAN":
"""
Fit HDBSCAN model from features.
"""
Expand All @@ -923,7 +923,6 @@ class HDBSCAN(InteropMixin, ClusterMixin, CMajorInputTagMixin, Base):
self,
X,
dtype="float32",
convert_dtype=convert_dtype,
mem_type=mem_type,
ensure_min_samples=2,
return_index=True,
Expand Down Expand Up @@ -1177,12 +1176,7 @@ def all_points_membership_vectors(clusterer, int batch_size=4096):


@mlfunc(model_arg="clusterer", array_arg="points_to_predict", preserve_index=True)
def membership_vector(
clusterer,
points_to_predict,
int batch_size=4096,
convert_dtype="deprecated",
):
def membership_vector(clusterer, points_to_predict, int batch_size=4096):
"""
Predict soft cluster membership. The result produces a vector
for each point in ``points_to_predict`` that gives a probability that
Expand Down Expand Up @@ -1221,7 +1215,6 @@ def membership_vector(
clusterer,
points_to_predict,
dtype="float32",
convert_dtype=convert_dtype,
order="C",
)
cdef int n_prediction_points = points_to_predict.shape[0]
Expand Down Expand Up @@ -1261,7 +1254,7 @@ def membership_vector(


@mlfunc(model_arg="clusterer", array_arg="points_to_predict", preserve_index=True)
def approximate_predict(clusterer, points_to_predict, convert_dtype="deprecated"):
def approximate_predict(clusterer, points_to_predict):
"""Predict the cluster label of new points. The returned labels
will be those of the original clustering found by ``clusterer``,
and therefore are not (necessarily) the cluster labels that would
Expand Down Expand Up @@ -1305,7 +1298,6 @@ def approximate_predict(clusterer, points_to_predict, convert_dtype="deprecated"
clusterer,
points_to_predict,
dtype="float32",
convert_dtype=convert_dtype,
order="C",
)
cdef int n_prediction_points = points_to_predict.shape[0]
Expand Down
33 changes: 9 additions & 24 deletions python/cuml/cuml/cluster/kmeans.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ class KMeans(InteropMixin,

@generate_docstring()
@mlfunc(set_input_type=True)
def fit(self, X, y=None, sample_weight=None, *, convert_dtype="deprecated") -> "KMeans":
def fit(self, X, y=None, sample_weight=None) -> "KMeans":
"""
Compute k-means clustering with X.

Expand All @@ -745,7 +745,6 @@ class KMeans(InteropMixin,
X,
sample_weight=sample_weight,
dtype=("float32", "float64"),
convert_dtype=convert_dtype,
order=None,
mem_type=None,
reset=True,
Expand Down Expand Up @@ -783,7 +782,6 @@ class KMeans(InteropMixin,
self.init,
order="C",
dtype=X.dtype,
convert_dtype=convert_dtype,
).copy()
if centers.shape[0] != self.n_clusters:
raise ValueError(
Expand Down Expand Up @@ -1006,7 +1004,7 @@ class KMeans(InteropMixin,
"""
return self.fit(X, sample_weight=sample_weight).labels_

def _predict_labels_inertia(self, X, convert_dtype="deprecated", sample_weight=None):
def _predict_labels_inertia(self, X, sample_weight=None):
"""
Predict the closest cluster each sample in X belongs to.

Expand All @@ -1017,13 +1015,6 @@ class KMeans(InteropMixin,
Acceptable formats: cuDF DataFrame, NumPy ndarray, Numba device
ndarray, cuda array interface compliant array like CuPy

convert_dtype : bool, default="deprecated"
.. deprecated:: 26.08
`convert_dtype` was deprecated in version 26.08 and will be
removed in version 26.10. cuML only copies input arrays when
necessary (e.g. to unify dtypes), there is no reason to provide
this keyword going forward.

sample_weight : array-like (device or host) shape = (n_samples,), default=None # noqa
The weights for each observation in X. If None, all observations
are assigned equal weight.
Expand All @@ -1042,7 +1033,6 @@ class KMeans(InteropMixin,
X,
sample_weight=sample_weight,
dtype=self.cluster_centers_.dtype,
convert_dtype=convert_dtype,
order="C",
)
if sample_weight is None:
Expand All @@ -1068,20 +1058,20 @@ class KMeans(InteropMixin,
'description': 'Cluster indexes',
'shape': '(n_samples, 1)'})
@mlfunc(preserve_index=True)
def predict(self, X, *, convert_dtype="deprecated"):
def predict(self, X):
"""
Predict the closest cluster each sample in X belongs to.

"""
labels, _ = self._predict_labels_inertia(X, convert_dtype=convert_dtype)
labels, _ = self._predict_labels_inertia(X)
return labels

@generate_docstring(return_values={'name': 'X_new',
'type': 'dense',
'description': 'Transformed data',
'shape': '(n_samples, n_clusters)'})
@mlfunc(preserve_index=True)
def transform(self, X, *, convert_dtype="deprecated"):
def transform(self, X):
"""
Transform X to a cluster-distance space.

Expand All @@ -1091,7 +1081,6 @@ class KMeans(InteropMixin,
self,
X,
dtype=self.cluster_centers_.dtype,
convert_dtype=convert_dtype,
order="C",
)

Expand Down Expand Up @@ -1178,28 +1167,24 @@ class KMeans(InteropMixin,
of X on the K-means \
objective.'})
@mlfunc(convert_output=False)
def score(self, X, y=None, sample_weight=None, *, convert_dtype="deprecated"):
def score(self, X, y=None, sample_weight=None):
"""
Opposite of the value of X on the K-means objective.

"""

inertia = self._predict_labels_inertia(
X, convert_dtype=convert_dtype, sample_weight=sample_weight
)[1]
inertia = self._predict_labels_inertia(X, sample_weight=sample_weight)[1]
return -1 * inertia

@generate_docstring(return_values={'name': 'X_new',
'type': 'dense',
'description': 'Transformed data',
'shape': '(n_samples, n_clusters)'})
@mlfunc(preserve_index=True)
def fit_transform(
self, X, y=None, sample_weight=None, *, convert_dtype="deprecated"
):
def fit_transform(self, X, y=None, sample_weight=None):
"""
Compute clustering and transform X to cluster-distance space.

"""
self.fit(X, sample_weight=sample_weight)
return self.transform(X, convert_dtype=convert_dtype)
return self.transform(X)
10 changes: 1 addition & 9 deletions python/cuml/cuml/common/doc_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -54,12 +54,6 @@
" Acceptable dense formats: CUDA array interface compliant objects like\n" # noqa
" CuPy, cuDF DataFrame/Series, NumPy ndarray and Pandas\n"
" DataFrame/Series.",
"convert_dtype": "convert_dtype : bool, optional (default = 'deprecated')\n"
" .. deprecated:: 26.08\n"
" `convert_dtype` was deprecated in version 26.08 and will be removed\n"
" in version 26.10. cuML only copies input arrays when necessary\n"
" (e.g. to unify dtypes), there is no reason to provide this keyword\n"
" going forward.\n",
"sample_weight": "sample_weight : array-like (device or host) shape = (n_samples,), default={default}\n" # noqa
" The weights for each observation in X. If None, all observations\n"
" are assigned equal weight.\n"
Expand Down Expand Up @@ -107,7 +101,6 @@
_return_values_possible_values = ["name", "type", "shape", "description"]

_simple_params = [
"convert_dtype",
"return_sparse",
"sparse_tol",
"sample_weight",
Expand All @@ -134,7 +127,6 @@ def generate_docstring(
Currently auto detected variables include:
- X
- y
- convert_dtype
- sample_weights
- return_sparse
- sparse_tol
Expand Down
11 changes: 1 addition & 10 deletions python/cuml/cuml/covariance/empirical_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ def __init__(
self.assume_centered = assume_centered

@mlfunc(set_input_type=True)
def fit(
self, X, y=None, *, convert_dtype="deprecated"
) -> "EmpiricalCovariance":
def fit(self, X, y=None) -> "EmpiricalCovariance":
"""Fit the maximum likelihood covariance estimator to X.

Parameters
Expand All @@ -159,12 +157,6 @@ def fit(
and `n_features` is the number of features.
y : Ignored
Not used, present for API consistency.
convert_dtype : bool, default="deprecated"
.. deprecated:: 26.08
`convert_dtype` was deprecated in version 26.08 and will be
removed in version 26.10. cuML only copies input arrays when
necessary (e.g. to unify dtypes), there is no reason to provide
this keyword going forward.

Returns
-------
Expand All @@ -175,7 +167,6 @@ def fit(
self,
X,
dtype=("float32", "float64"),
convert_dtype=convert_dtype,
reset=True,
)
if X.shape[0] == 1:
Expand Down
9 changes: 1 addition & 8 deletions python/cuml/cuml/covariance/ledoit_wolf.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __init__(
self.block_size = block_size

@mlfunc(set_input_type=True)
def fit(self, X, y=None, *, convert_dtype="deprecated") -> "LedoitWolf":
def fit(self, X, y=None) -> "LedoitWolf":
"""Fit the Ledoit-Wolf shrunk covariance model to X.

Parameters
Expand All @@ -238,12 +238,6 @@ def fit(self, X, y=None, *, convert_dtype="deprecated") -> "LedoitWolf":
and `n_features` is the number of features.
y : Ignored
Not used, present for API consistency.
convert_dtype : bool, default="deprecated"
.. deprecated:: 26.08
`convert_dtype` was deprecated in version 26.08 and will be
removed in version 26.10. cuML only copies input arrays when
necessary (e.g. to unify dtypes), there is no reason to provide
this keyword going forward.

Returns
-------
Expand All @@ -254,7 +248,6 @@ def fit(self, X, y=None, *, convert_dtype="deprecated") -> "LedoitWolf":
self,
X,
dtype=("float32", "float64"),
convert_dtype=convert_dtype,
reset=True,
)
if X.shape[0] == 1:
Expand Down
9 changes: 4 additions & 5 deletions python/cuml/cuml/dask/ensemble/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -88,7 +88,7 @@ def _estimators_per_worker(self, n_estimators):
n_estimators_per_worker[i] = n_estimators_per_worker[i] + 1
return n_estimators_per_worker

def _fit(self, model, dataset, convert_dtype, broadcast_data):
def _fit(self, model, dataset, broadcast_data):
data = DistributedDataHandler.create(dataset, client=self.client)
self.active_workers = data.workers
self.datatype = data.datatype
Expand All @@ -114,7 +114,6 @@ def _fit(self, model, dataset, convert_dtype, broadcast_data):
_func_fit,
model[worker],
combined_data if broadcast_data else worker_data,
convert_dtype,
workers=[worker],
pure=False,
)
Expand Down Expand Up @@ -305,10 +304,10 @@ def apply_reduction(self, reduce, partial_infs, datatype, delayed):
return delayed_res.persist()


def _func_fit(model, input_data, convert_dtype):
def _func_fit(model, input_data):
X = concatenate([item[0] for item in input_data])
y = concatenate([item[1] for item in input_data])
return model.fit(X, y, convert_dtype=convert_dtype)
return model.fit(X, y)


def _func_predict_partial(model, input_data, **kwargs):
Expand Down
Loading
Loading