Skip to content

Deprecate convert_dtype - #8300

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
jcrist:deprecate-convert-dtype
Jul 1, 2026
Merged

Deprecate convert_dtype#8300
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
jcrist:deprecate-convert-dtype

Conversation

@jcrist

@jcrist jcrist commented Jun 30, 2026

Copy link
Copy Markdown
Member

This deprecates the convert_dtype kwarg everywhere in cuml.

See #7646 for more information. In short, we're removing it for the following reasons:

  • There are other reasons we make a copy within cuml besides incorrect dtype. We also have order requirements, contiguity requirements, host/device requirements, or sometimes even algorithmic mutation requirements. Singling out dtype over other reasons to say "don't ever copy" feels off.
  • The documentation makes it sound like setting convert_dtype=False may be a memory optimization, but in reality it just removes one place where we might make a copy and replaces it with a loud error. I fail to see the use case for this option.
  • Additional kwargs on methods and functions muddy our API and make it harder for a user to find valid options. There is a usability cost to too many knobs.
  • Not every method or function implements convert_dtype, and not every method or function implements it consistently. An inconsistent API is a UX issue.

There is no replacement option, as the parameter either led to errors or did nothing if the inputs were of the required dtype. Users who were providing this parameter before should just stop using it.

Fixes #7646.

@jcrist jcrist self-assigned this Jun 30, 2026
@jcrist
jcrist requested a review from a team as a code owner June 30, 2026 18:04
@jcrist
jcrist requested a review from dantegd June 30, 2026 18:04
@jcrist jcrist added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 30, 2026
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Jun 30, 2026

@jcrist jcrist left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annotating the diff for some notable locations. All other files are mechanical changes.

@@ -538,7 +538,7 @@ def check_array(
accept_sparse=False,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file implements the deprecation.

assert ptr(res.indptr) != ptr(array.indptr)


def test_convert_dtype_deprecated():

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we test the deprecation.

"convert_dtype_single": "convert_dtype : bool, optional (default = {default})\n"
" When set to True, the method will automatically\n"
" convert the inputs to {dtype}.",
"convert_dtype": "convert_dtype : bool, optional (default = 'deprecated')\n"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we update the docstring generator for documenting the deprecation of convert_dtype.

I also slightly updated the dtype notes on other arg types. In the future I'd like to do more cleanups here (regarding how we document other parameters), was only trying to do the minimal amount so things weren't definitely incorrect.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added deprecation handling for convert_dtype across many estimators and metrics, including updated parameter defaults and documentation.
    • Updated the public/default behavior to treat convert_dtype=True as legacy and steer callers toward the deprecated sentinel/default.
  • Bug Fixes
    • Improved consistency in dtype-handling defaults across clustering, linear models, neighbors, SVM, decomposition, UMAP/TSNE, and time-series APIs.
    • Validation now emits FutureWarning when convert_dtype=True legacy behavior is used.
  • Tests
    • Updated tests to omit explicit convert_dtype usage by default, added warning coverage, and removed/renamed dtype-conversion-specific assertions.

Walkthrough

Deprecates convert_dtype across cuML by changing public defaults to "deprecated", updating validation to warn on legacy usage, removing docstring-generation special cases, and aligning tests to stop passing explicit convert_dtype=True or relying on deprecated error paths.

Changes

Validation, docstrings, and API defaults

Layer / File(s) Summary
Core validation and docstring infrastructure
python/cuml/cuml/internals/validation.py, python/cuml/cuml/common/doc_utils.py
check_array, check_y, check_sample_weight, and check_inputs default convert_dtype to "deprecated", check_array emits a FutureWarning for non-sentinel values and changes its conversion guard, and generate_docstring drops convert_dtype_cast while simplifying convert_dtype doc generation.
Core estimator signatures
python/cuml/cuml/cluster/..., python/cuml/cuml/covariance/..., python/cuml/cuml/decomposition/..., python/cuml/cuml/linear_model/..., python/cuml/cuml/random_projection/..., python/cuml/cuml/kernel_ridge/..., python/cuml/cuml/solvers/..., python/cuml/cuml/svm/...
Public fit/predict/transform/score/decision_function signatures switch convert_dtype defaults to "deprecated" across cluster, covariance, decomposition, linear, random projection, kernel ridge, solver, and SVM APIs.
Remaining estimator signatures
python/cuml/cuml/ensemble/..., python/cuml/cuml/neighbors/..., python/cuml/cuml/manifold/..., python/cuml/cuml/explainer/..., python/cuml/cuml/naive_bayes/..., python/cuml/cuml/tsa/...
Ensemble, neighbors, manifold, explainer, Naive Bayes, and time-series APIs make the same default change, with nearest_neighbors.pyx also dropping explicit convert_dtype=True in a few internal check_array calls.
Metrics signatures and docs
python/cuml/cuml/metrics/...
Metrics functions update convert_dtype defaults and deprecation text for adjusted Rand score, silhouette, confusion matrix, KL divergence, pairwise distances/kernels, and trustworthiness.

Test updates

Layer / File(s) Summary
Test cleanup
python/cuml/tests/..., python/cuml/tests/dask/...
Tests stop passing convert_dtype=True, remove branches that expected convert_dtype=False failures, rename mixed-dtype coverage, and delete obsolete downcast/deprecation tests. Dask KNN and UMAP/TSNE test flows are updated to rely on default dtype handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • rapidsai/cuml#7973: Modifies python/cuml/cuml/internals/validation.py, the same validation path that now emits the convert_dtype deprecation warning.
  • rapidsai/cuml#8268: Touches python/cuml/cuml/metrics/pairwise_distances.pyx, which also changes convert_dtype defaults and docstrings here.
  • rapidsai/cuml#8269: Touches python/cuml/cuml/metrics/confusion_matrix.py, which is updated in this PR as part of the same convert_dtype deprecation sweep.

Suggested labels

sklearn-api-compat

Suggested reviewers

  • csadorf
  • betatim
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Some touched files include unrelated SPDX/copyright year bumps, which are outside the convert_dtype deprecation scope. Remove the copyright-year-only edits or split them into a separate housekeeping PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 48.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed It clearly summarizes the main change: deprecating convert_dtype across cuML.
Description check ✅ Passed The description is on-topic and matches the deprecation-focused changeset.
Linked Issues check ✅ Passed The PR implements the deprecation phase requested in #7646 across the affected APIs and updates supporting docs/tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (15)
python/cuml/cuml/internals/validation.py (2)

1354-1370: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: check_sample_weight only warns on array-like inputs.

None and scalar sample_weight values return before check_array(...), so check_sample_weight(None, convert_dtype=True) and scalar calls silently bypass the deprecation. That leaves a public helper with input-dependent warning behavior.

Proposed fix
 def check_sample_weight(
     sample_weight,
     *,
     dtype=None,
     convert_dtype="deprecated",
@@
 ):
     """Validate and coerce ``sample_weight`` to a supported type.
@@
     """
+    if convert_dtype != "deprecated":
+        warnings.warn(
+            "`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.",
+            FutureWarning,
+        )
+
     if sample_weight is None:
         return None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/internals/validation.py` around lines 1354 - 1370,
`check_sample_weight` has input-dependent deprecation behavior because `None`
and scalar values return before `check_array(...)`, so they skip the
`convert_dtype` warning path. Update `check_sample_weight` so the deprecation
check runs for all inputs, including `None` and scalar `sample_weight`, by
moving or duplicating the `convert_dtype` handling ahead of the early returns.
Keep the existing validation logic in `check_sample_weight` and
`check_array`/`validate_sample_weight` flow consistent for array-like, scalar,
and `None` inputs.

Source: Coding guidelines


1131-1169: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: check_y(..., return_classes=True) skips the convert_dtype deprecation warning.

This branch never emits the new warning: it omits convert_dtype from the internal check_array(...) call, so check_y(y, return_classes=True, convert_dtype=True/False) is silent while the return_classes=False path warns. That makes the helper’s deprecation behavior branch-dependent and the new test won’t catch it because it only exercises the non-return_classes path.

Proposed fix
 def check_y(
     y,
     *,
     dtype=None,
     convert_dtype="deprecated",
@@
 ):
     """Validate and coerce ``y`` to a supported type.
@@
     """
+    if convert_dtype != "deprecated":
+        warnings.warn(
+            "`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.",
+            FutureWarning,
+        )
+
     if y is None:
         raise ValueError(
             "This estimator requires y to be passed, but the target y is None"
         )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/internals/validation.py` around lines 1131 - 1169, The
`check_y(..., return_classes=True)` branch is missing the `convert_dtype`
deprecation warning that the non-`return_classes` path already emits. Update
`check_y` so the `return_classes` flow also routes through the same deprecation
handling around the internal `check_array(...)` call, using the existing
`convert_dtype` argument and warning logic consistently in both branches.

Source: Coding guidelines

python/cuml/tests/test_logistic_regression.py (1)

474-482: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: test_logistic_predict_output_dtype no longer checks output dtype.

After the rename, this still only verifies that predict() does not raise. A regression in the returned dtype/type would pass unnoticed, so the test should assert the expected prediction dtype/type explicitly (or keep the old smoke-test-oriented name). As per coding guidelines, HIGH test issues include cases that only check “runs without error” in python/** tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/tests/test_logistic_regression.py` around lines 474 - 482,
`test_logistic_predict_output_dtype` currently only smoke-tests
`cuLog.predict()` and does not validate the returned dtype/type. Update this
test to capture the result of `clf.predict(X_test.astype(test_dtype))` and
assert the expected prediction dtype or array type explicitly, using the
existing `dataset`, `test_dtype`, and `cuLog` setup; if you intentionally want a
smoke test, rename the test to reflect that behavior instead.

Source: Coding guidelines

python/cuml/cuml/metrics/pairwise_distances.pyx (1)

270-303: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: Forward convert_dtype through the nan_euclidean dispatch.

Changing this parameter to the deprecation sentinel exposes that pairwise_distances(..., metric="nan_euclidean", convert_dtype=False) still drops the caller-supplied value at the early return. That changes behavior before the advertised removal window and skips the warning path entirely.

As per coding guidelines, Python API changes should preserve backward-compatible behavior throughout the deprecation cycle.

Proposed fix
-    if metric == "nan_euclidean":
-        return nan_euclidean_distances(X, Y, **kwds)
+    if metric == "nan_euclidean":
+        return nan_euclidean_distances(
+            X, Y, convert_dtype=convert_dtype, **kwds
+        )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/metrics/pairwise_distances.pyx` around lines 270 - 303, The
early-return path in pairwise_distances for metric="nan_euclidean" is dropping
the caller’s convert_dtype value, which bypasses the existing deprecation
behavior. Update the pairwise_distances dispatch so the nan_euclidean branch
still forwards convert_dtype into the downstream implementation instead of
replacing it with the deprecation sentinel. Make the change in the
pairwise_distances function while preserving the current warning/deprecation
flow and backward-compatible behavior.

Source: Coding guidelines

python/cuml/cuml/metrics/pairwise_kernels.py (1)

181-187: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: pairwise_kernels won't emit the advertised convert_dtype deprecation.

This signature/docstring now deprecates convert_dtype, but the implementation still calls check_array() with its own default and never forwards the caller's value. As written, pairwise_kernels(..., convert_dtype=...) will skip the shared FutureWarning path entirely, so users get no notice before the kwarg is removed.

Suggested fix
-    X = check_array(X, input_name="X")
+    X = check_array(X, input_name="X", convert_dtype=convert_dtype)

Also applies to: 227-233

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/metrics/pairwise_kernels.py` around lines 181 - 187,
`pairwise_kernels` is not forwarding the deprecated `convert_dtype` argument
into the shared input validation path, so the expected deprecation warning never
fires. Update `pairwise_kernels` to pass the caller-provided `convert_dtype`
through to `check_array()` (and any related validation helper used before kernel
computation), and keep the handling consistent with the other metric wrappers so
the FutureWarning is emitted whenever this kwarg is used.
python/cuml/cuml/cluster/kmeans.pyx (1)

805-813: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: fit_transform still ignores convert_dtype during the fit step.

fit_transform(..., convert_dtype=...) calls self.fit(X, sample_weight=sample_weight) without forwarding the kwarg, so the argument is only honored for transform. That can silently coerce during fit and then fail during transform, leaving the estimator fitted after fit_transform raises.

Proposed fix
     def fit_transform(
         self, X, y=None, sample_weight=None, *, convert_dtype="deprecated"
     ) -> CumlArray:
         """
         Compute clustering and transform X to cluster-distance space.

         """
-        self.fit(X, sample_weight=sample_weight)
+        self.fit(
+            X,
+            sample_weight=sample_weight,
+            convert_dtype=convert_dtype,
+        )
         return self.transform(X, convert_dtype=convert_dtype)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/cluster/kmeans.pyx` around lines 805 - 813, The
`KMeans.fit_transform` path is not forwarding `convert_dtype` into the fit step,
so the kwarg is only applied in `transform`. Update `fit_transform` to pass
`convert_dtype` through to `self.fit(...)` as well as `self.transform(...)`,
matching the existing `fit`/`transform` behavior and ensuring dtype handling is
consistent across the full call.
python/cuml/cuml/decomposition/incremental_pca.py (2)

205-224: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: fit() exposes convert_dtype without documenting the deprecation.

The public signature now includes convert_dtype="deprecated", but the docstring still documents only X and y. That leaves the published API docs inconsistent with transform() and hides the removal timeline from callers.

📝 Suggested doc update
         Parameters
         ----------
         X : array-like or sparse matrix, shape (n_samples, n_features)
             Training data, where n_samples is the number of samples and
             n_features is the number of features.
         y : Ignored
+        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.

As per coding guidelines, "Missing or incorrect docstrings for public methods" is a HIGH issue.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/decomposition/incremental_pca.py` around lines 205 - 224,
Update the IncrementalPCA.fit docstring to document the convert_dtype keyword
and its deprecation status so the public API matches the signature. In the fit
method, add a Parameters entry for convert_dtype and note that it is deprecated,
aligning the wording with the existing transform() documentation and making the
deprecation/removal timeline explicit for callers.

Source: Coding guidelines


401-455: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: Dense transform() silently drops the caller's convert_dtype.

The sparse branch forwards convert_dtype into check_inputs, but the dense branch calls super().transform(X) without it. For dense inputs, an explicit convert_dtype=False/True therefore never reaches the validation layer, so the deprecation warning and any non-default behavior are skipped only for that path.

🔧 Suggested fix
-            return super().transform(X)
+            return super().transform(X, convert_dtype=convert_dtype)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/decomposition/incremental_pca.py` around lines 401 - 455,
The dense path in IncrementalPCA.transform is dropping the caller-provided
convert_dtype value, so the behavior differs from the sparse branch. Update
transform so the explicit convert_dtype argument is forwarded through the dense
branch as well, using the existing super().transform path in a way that
preserves this parameter. Keep the sparse branch’s check_inputs flow unchanged,
and ensure the deprecation behavior for convert_dtype is exercised consistently
for both dense and sparse inputs.
python/cuml/cuml/metrics/cluster/silhouette_score.pyx (1)

143-179: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: Document convert_dtype on the silhouette public wrappers.

Issue: both wrappers accept convert_dtype="deprecated" but their docstrings omit the deprecation/removal notice. Impact: users won’t get consistent migration guidance across metrics APIs.

As per coding guidelines, “Missing or incorrect docstrings for public methods” are high issues.

Proposed docstring additions
     chunksize : integer (default = None)
         An integer, 1 <= chunksize <= n_samples to tile the pairwise distance
         matrix computations, so as to reduce the quadratic memory usage of
         having the entire pairwise distance matrix in GPU memory.
         If None, chunksize will automatically be set to 40000, which through
         experiments has proved to be a safe number for the computation
         to run on a GPU with 16 GB VRAM.
+    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.

Apply this section to both cython_silhouette_score and cython_silhouette_samples.

Also applies to: 182-220

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/metrics/cluster/silhouette_score.pyx` around lines 143 -
179, The public silhouette wrappers `cython_silhouette_score` and
`cython_silhouette_samples` accept `convert_dtype="deprecated"` but their
docstrings do not mention the deprecation or removal guidance. Update both
docstrings to document `convert_dtype` with a clear deprecation notice and
migration guidance so the public API matches the other metrics wrappers and
users see consistent guidance.

Source: Coding guidelines

python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx (1)

22-37: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: Add the convert_dtype deprecation notice to the public docstring.

Issue: the public signature exposes convert_dtype="deprecated", but the docstring omits the parameter and removal timeline. Impact: users won’t see deprecation guidance for this metrics API.

As per coding guidelines, “Missing or incorrect docstrings for public methods” are high issues.

Proposed docstring addition
     labels_pred : Array of predicted labels used to evaluate the model
 
+    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
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx` around lines 22 -
37, Update the public docstring for adjusted_rand_score to document the
convert_dtype argument as deprecated, including the deprecation notice and
removal timeline. Make sure the Parameters section mentions convert_dtype
alongside labels_true and labels_pred, and reference the adjusted_rand_score
signature so the docstring matches the exposed API. Keep the guidance explicit
that this parameter is deprecated and should not be used in new code.

Source: Coding guidelines

python/cuml/cuml/dask/neighbors/kneighbors_classifier.py (1)

280-299: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: Document score’s deprecated convert_dtype parameter.

Issue: score still accepts the changed public keyword but the docstring omits the deprecation/removal notice. Impact: users calling score(..., convert_dtype=...) do not get API migration guidance from the docs.

As per coding guidelines, “Missing or incorrect docstrings for public methods” are high issues.

Proposed docstring addition
         y : array-like (device or host) shape = (n_samples, n_features)
             Labels test data.
             Acceptable formats: dask CuPy/NumPy/Numba Array
 
+        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
         -------
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/dask/neighbors/kneighbors_classifier.py` around lines 280 -
299, The public method score in kneighbors_classifier.KNeighborsClassifier still
accepts convert_dtype but its docstring does not mention that the parameter is
deprecated. Update the score docstring to document convert_dtype as a deprecated
keyword, including a brief deprecation/removal note in the Parameters section so
users know how to migrate; keep the change localized to the score method
documentation.

Source: Coding guidelines

python/cuml/cuml/neighbors/nearest_neighbors.pyx (1)

705-727: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: Sparse kneighbors still drops explicit convert_dtype values.

kneighbors() now advertises the deprecation contract, but the sparse path still never forwards the caller’s convert_dtype into check_array. That means convert_dtype=True on CSR input will not emit the new FutureWarning, and convert_dtype=False is still silently ignored for sparse queries.

Suggested fix
-            distances_cp, indices_cp = self._kneighbors_sparse(X, n_neighbors)
+            distances_cp, indices_cp = self._kneighbors_sparse(
+                X, n_neighbors, convert_dtype=convert_dtype
+            )
-    def _kneighbors_sparse(self, X, int n_neighbors):
+    def _kneighbors_sparse(
+        self, X, int n_neighbors, *, convert_dtype="deprecated"
+    ):
         if not is_sparse(X):
             raise ValueError("A NearestNeighbors model trained on sparse "
                              "data requires sparse input to kneighbors()")
@@
         X_cp = check_array(
             X,
             dtype="float32",
             accept_sparse=["csr"],
             input_name="X",
+            convert_dtype=convert_dtype,
         )

Also applies to: 901-905

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/neighbors/nearest_neighbors.pyx` around lines 705 - 727, The
sparse kneighbors path in nearest_neighbors.pyx is still ignoring the caller’s
explicit convert_dtype value, so update the sparse-input handling in
kneighbors() to pass convert_dtype through to check_array just like the dense
path. Make sure the same fix is applied wherever the sparse branch is handled so
explicit convert_dtype=True/False behavior is preserved and the deprecation
warning contract is triggered consistently.
python/cuml/cuml/svm/svc.py (1)

417-437: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: Multiclass SVC inference bypasses the new convert_dtype contract.

Both multiclass branches drop the caller’s convert_dtype by delegating to self._multiclass.*(X) directly. So binary SVC will still warn on legacy convert_dtype=True/False, but multiclass SVC will not, and False is effectively ignored on those paths.

Also applies to: 448-460

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/svm/svc.py` around lines 417 - 437, The multiclass path in
SVC.predict is bypassing the new convert_dtype behavior, so the _multiclass
branch should be updated to honor the caller’s convert_dtype argument just like
the binary path does. Adjust the multiclass delegation in predict (and any
shared multiclass helper it calls) so legacy convert_dtype values still trigger
the expected warning/handling and are not silently ignored, while keeping
decode_labels and _get_output_type unchanged.
python/cuml/cuml/dask/manifold/umap.py (1)

90-112: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

HIGH: UMAP.transform still omits the deprecated convert_dtype parameter from its docs.

The signature now exposes convert_dtype="deprecated", but the public docstring never mentions that parameter or its 26.10 removal timeline, so generated API docs stay out of sync with the actual API. As per coding guidelines, "Missing or incorrect docstrings for public methods" and "Hyperparameters not documented" are HIGH issues.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/dask/manifold/umap.py` around lines 90 - 112, The public
docstring for UMAP.transform is out of sync with the signature because it does
not document convert_dtype="deprecated" or its planned removal in 26.10. Update
the transform() docstring in the UMAP class to add a Parameters entry for
convert_dtype, marking it deprecated and noting the removal timeline so the API
docs match the actual method signature.

Source: Coding guidelines

python/cuml/cuml/explainer/tree_shap.pyx (1)

158-166: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: TreeExplainer.__init__ skips the deprecation warning when data=None.

Here convert_dtype only flows through check_array inside the if data is not None block, so TreeExplainer(model=..., convert_dtype=True) is silently accepted and callers never get the 26.10 removal warning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/explainer/tree_shap.pyx` around lines 158 - 166,
TreeExplainer.__init__ only routes convert_dtype through check_array when data
is provided, so the deprecation/removal warning is skipped for data=None. Update
the TreeExplainer.__init__ path to always validate convert_dtype and emit the
deprecation warning even when data is absent, using the existing check_array
handling or an equivalent shared validation path so callers of
TreeExplainer(model=..., convert_dtype=True) still see the 26.10 warning.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cuml/cuml/cluster/hdbscan/hdbscan.pyx`:
- Around line 1187-1192: The public helper docstrings for membership_vector and
approximate_predict are missing the deprecated convert_dtype kwarg, so update
both docstrings to explicitly document convert_dtype as deprecated and describe
its current behavior. Make sure the changes are applied in the definitions of
membership_vector and approximate_predict so the published API docs match the
runtime warning/removal behavior.

In `@python/cuml/cuml/explainer/tree_shap.pyx`:
- Line 158: The public TreeExplainer APIs are missing documentation for the
deprecated convert_dtype keyword, so update the docstrings for
TreeExplainer.__init__, TreeExplainer.shap_values, and
TreeExplainer.shap_interaction_values to explicitly mention convert_dtype, that
it is deprecated, and the intended removal timeline. Keep the parameter lists
consistent across these methods and ensure the public API docs reflect the
current signature exposed in tree_shap.pyx.

In `@python/cuml/cuml/linear_model/linear_regression.pyx`:
- Around line 313-320: The LinearRegression.fit signature currently makes
convert_dtype keyword-only, which breaks existing positional callers during the
deprecation window. Update fit in linear_regression.pyx to keep convert_dtype
accepting positional arguments while still emitting the deprecation warning, and
only enforce the keyword-only form after the removal period. Use the existing
LinearRegression.fit entry point and its convert_dtype handling to preserve
backward compatibility for callers like fit(X, y, sample_weight, False).

In `@python/cuml/cuml/tsa/arima.pyx`:
- Line 957: ARIMA.fit() is still using the deprecated dtype-conversion path by
default because it hardcodes convert_dtype=True before calling _loglike,
_loglike_grad, and unpack(). Update ARIMA.fit so its default matches the new
sentinel-based behavior and only opts into dtype conversion when the caller
explicitly requests it, then propagate that same sentinel value through the
_loglike/_loglike_grad/unpack call chain.

---

Outside diff comments:
In `@python/cuml/cuml/cluster/kmeans.pyx`:
- Around line 805-813: The `KMeans.fit_transform` path is not forwarding
`convert_dtype` into the fit step, so the kwarg is only applied in `transform`.
Update `fit_transform` to pass `convert_dtype` through to `self.fit(...)` as
well as `self.transform(...)`, matching the existing `fit`/`transform` behavior
and ensuring dtype handling is consistent across the full call.

In `@python/cuml/cuml/dask/manifold/umap.py`:
- Around line 90-112: The public docstring for UMAP.transform is out of sync
with the signature because it does not document convert_dtype="deprecated" or
its planned removal in 26.10. Update the transform() docstring in the UMAP class
to add a Parameters entry for convert_dtype, marking it deprecated and noting
the removal timeline so the API docs match the actual method signature.

In `@python/cuml/cuml/dask/neighbors/kneighbors_classifier.py`:
- Around line 280-299: The public method score in
kneighbors_classifier.KNeighborsClassifier still accepts convert_dtype but its
docstring does not mention that the parameter is deprecated. Update the score
docstring to document convert_dtype as a deprecated keyword, including a brief
deprecation/removal note in the Parameters section so users know how to migrate;
keep the change localized to the score method documentation.

In `@python/cuml/cuml/decomposition/incremental_pca.py`:
- Around line 205-224: Update the IncrementalPCA.fit docstring to document the
convert_dtype keyword and its deprecation status so the public API matches the
signature. In the fit method, add a Parameters entry for convert_dtype and note
that it is deprecated, aligning the wording with the existing transform()
documentation and making the deprecation/removal timeline explicit for callers.
- Around line 401-455: The dense path in IncrementalPCA.transform is dropping
the caller-provided convert_dtype value, so the behavior differs from the sparse
branch. Update transform so the explicit convert_dtype argument is forwarded
through the dense branch as well, using the existing super().transform path in a
way that preserves this parameter. Keep the sparse branch’s check_inputs flow
unchanged, and ensure the deprecation behavior for convert_dtype is exercised
consistently for both dense and sparse inputs.

In `@python/cuml/cuml/explainer/tree_shap.pyx`:
- Around line 158-166: TreeExplainer.__init__ only routes convert_dtype through
check_array when data is provided, so the deprecation/removal warning is skipped
for data=None. Update the TreeExplainer.__init__ path to always validate
convert_dtype and emit the deprecation warning even when data is absent, using
the existing check_array handling or an equivalent shared validation path so
callers of TreeExplainer(model=..., convert_dtype=True) still see the 26.10
warning.

In `@python/cuml/cuml/internals/validation.py`:
- Around line 1354-1370: `check_sample_weight` has input-dependent deprecation
behavior because `None` and scalar values return before `check_array(...)`, so
they skip the `convert_dtype` warning path. Update `check_sample_weight` so the
deprecation check runs for all inputs, including `None` and scalar
`sample_weight`, by moving or duplicating the `convert_dtype` handling ahead of
the early returns. Keep the existing validation logic in `check_sample_weight`
and `check_array`/`validate_sample_weight` flow consistent for array-like,
scalar, and `None` inputs.
- Around line 1131-1169: The `check_y(..., return_classes=True)` branch is
missing the `convert_dtype` deprecation warning that the non-`return_classes`
path already emits. Update `check_y` so the `return_classes` flow also routes
through the same deprecation handling around the internal `check_array(...)`
call, using the existing `convert_dtype` argument and warning logic consistently
in both branches.

In `@python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx`:
- Around line 22-37: Update the public docstring for adjusted_rand_score to
document the convert_dtype argument as deprecated, including the deprecation
notice and removal timeline. Make sure the Parameters section mentions
convert_dtype alongside labels_true and labels_pred, and reference the
adjusted_rand_score signature so the docstring matches the exposed API. Keep the
guidance explicit that this parameter is deprecated and should not be used in
new code.

In `@python/cuml/cuml/metrics/cluster/silhouette_score.pyx`:
- Around line 143-179: The public silhouette wrappers `cython_silhouette_score`
and `cython_silhouette_samples` accept `convert_dtype="deprecated"` but their
docstrings do not mention the deprecation or removal guidance. Update both
docstrings to document `convert_dtype` with a clear deprecation notice and
migration guidance so the public API matches the other metrics wrappers and
users see consistent guidance.

In `@python/cuml/cuml/metrics/pairwise_distances.pyx`:
- Around line 270-303: The early-return path in pairwise_distances for
metric="nan_euclidean" is dropping the caller’s convert_dtype value, which
bypasses the existing deprecation behavior. Update the pairwise_distances
dispatch so the nan_euclidean branch still forwards convert_dtype into the
downstream implementation instead of replacing it with the deprecation sentinel.
Make the change in the pairwise_distances function while preserving the current
warning/deprecation flow and backward-compatible behavior.

In `@python/cuml/cuml/metrics/pairwise_kernels.py`:
- Around line 181-187: `pairwise_kernels` is not forwarding the deprecated
`convert_dtype` argument into the shared input validation path, so the expected
deprecation warning never fires. Update `pairwise_kernels` to pass the
caller-provided `convert_dtype` through to `check_array()` (and any related
validation helper used before kernel computation), and keep the handling
consistent with the other metric wrappers so the FutureWarning is emitted
whenever this kwarg is used.

In `@python/cuml/cuml/neighbors/nearest_neighbors.pyx`:
- Around line 705-727: The sparse kneighbors path in nearest_neighbors.pyx is
still ignoring the caller’s explicit convert_dtype value, so update the
sparse-input handling in kneighbors() to pass convert_dtype through to
check_array just like the dense path. Make sure the same fix is applied wherever
the sparse branch is handled so explicit convert_dtype=True/False behavior is
preserved and the deprecation warning contract is triggered consistently.

In `@python/cuml/cuml/svm/svc.py`:
- Around line 417-437: The multiclass path in SVC.predict is bypassing the new
convert_dtype behavior, so the _multiclass branch should be updated to honor the
caller’s convert_dtype argument just like the binary path does. Adjust the
multiclass delegation in predict (and any shared multiclass helper it calls) so
legacy convert_dtype values still trigger the expected warning/handling and are
not silently ignored, while keeping decode_labels and _get_output_type
unchanged.

In `@python/cuml/tests/test_logistic_regression.py`:
- Around line 474-482: `test_logistic_predict_output_dtype` currently only
smoke-tests `cuLog.predict()` and does not validate the returned dtype/type.
Update this test to capture the result of
`clf.predict(X_test.astype(test_dtype))` and assert the expected prediction
dtype or array type explicitly, using the existing `dataset`, `test_dtype`, and
`cuLog` setup; if you intentionally want a smoke test, rename the test to
reflect that behavior instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ca7fe0b3-1b7c-47e5-b1a9-19e2cbfaee17

📥 Commits

Reviewing files that changed from the base of the PR and between 91f42d1 and 97c3aed.

📒 Files selected for processing (74)
  • python/cuml/cuml/cluster/agglomerative.pyx
  • python/cuml/cuml/cluster/dbscan.pyx
  • python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
  • python/cuml/cuml/cluster/kmeans.pyx
  • python/cuml/cuml/common/doc_utils.py
  • python/cuml/cuml/covariance/empirical_covariance.py
  • python/cuml/cuml/covariance/ledoit_wolf.py
  • python/cuml/cuml/dask/ensemble/randomforestclassifier.py
  • python/cuml/cuml/dask/ensemble/randomforestregressor.py
  • python/cuml/cuml/dask/manifold/umap.py
  • python/cuml/cuml/dask/neighbors/kneighbors_classifier.py
  • python/cuml/cuml/dask/neighbors/kneighbors_regressor.py
  • python/cuml/cuml/decomposition/incremental_pca.py
  • python/cuml/cuml/decomposition/pca.pyx
  • python/cuml/cuml/decomposition/tsvd.pyx
  • python/cuml/cuml/ensemble/randomforestclassifier.py
  • python/cuml/cuml/ensemble/randomforestregressor.py
  • python/cuml/cuml/experimental/linear_model/lars.pyx
  • python/cuml/cuml/explainer/tree_shap.pyx
  • python/cuml/cuml/internals/validation.py
  • python/cuml/cuml/kernel_ridge/kernel_ridge.py
  • python/cuml/cuml/linear_model/base.py
  • python/cuml/cuml/linear_model/elastic_net.py
  • python/cuml/cuml/linear_model/linear_regression.pyx
  • python/cuml/cuml/linear_model/logistic_regression.py
  • python/cuml/cuml/linear_model/mbsgd_classifier.py
  • python/cuml/cuml/linear_model/mbsgd_regressor.py
  • python/cuml/cuml/linear_model/ridge.pyx
  • python/cuml/cuml/manifold/t_sne.pyx
  • python/cuml/cuml/manifold/umap/umap.pyx
  • python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx
  • python/cuml/cuml/metrics/cluster/silhouette_score.pyx
  • python/cuml/cuml/metrics/confusion_matrix.py
  • python/cuml/cuml/metrics/kl_divergence.pyx
  • python/cuml/cuml/metrics/pairwise_distances.pyx
  • python/cuml/cuml/metrics/pairwise_kernels.py
  • python/cuml/cuml/metrics/trustworthiness.pyx
  • python/cuml/cuml/naive_bayes/naive_bayes.py
  • python/cuml/cuml/neighbors/kernel_density.pyx
  • python/cuml/cuml/neighbors/kneighbors_classifier.pyx
  • python/cuml/cuml/neighbors/kneighbors_classifier_mg.pyx
  • python/cuml/cuml/neighbors/kneighbors_regressor.pyx
  • python/cuml/cuml/neighbors/kneighbors_regressor_mg.pyx
  • python/cuml/cuml/neighbors/nearest_neighbors.pyx
  • python/cuml/cuml/neighbors/nearest_neighbors_mg.pyx
  • python/cuml/cuml/random_projection/random_projection.py
  • python/cuml/cuml/solvers/cd.pyx
  • python/cuml/cuml/solvers/qn.pyx
  • python/cuml/cuml/solvers/sgd.pyx
  • python/cuml/cuml/svm/linear.pyx
  • python/cuml/cuml/svm/linear_svc.py
  • python/cuml/cuml/svm/linear_svr.py
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/cuml/svm/svr.py
  • python/cuml/cuml/tsa/arima.pyx
  • python/cuml/cuml/tsa/auto_arima.pyx
  • python/cuml/cuml/tsa/seasonality.py
  • python/cuml/cuml/tsa/stationarity.pyx
  • python/cuml/tests/dask/test_dask_kneighbors_classifier.py
  • python/cuml/tests/dask/test_dask_kneighbors_regressor.py
  • python/cuml/tests/test_elastic_net.py
  • python/cuml/tests/test_kernel_density.py
  • python/cuml/tests/test_linear_regression.py
  • python/cuml/tests/test_logistic_regression.py
  • python/cuml/tests/test_metrics.py
  • python/cuml/tests/test_nearest_neighbors.py
  • python/cuml/tests/test_random_forest.py
  • python/cuml/tests/test_solver_attributes.py
  • python/cuml/tests/test_svm.py
  • python/cuml/tests/test_trustworthiness.py
  • python/cuml/tests/test_tsne.py
  • python/cuml/tests/test_umap.py
  • python/cuml/tests/test_validation.py
💤 Files with no reviewable changes (2)
  • python/cuml/tests/test_nearest_neighbors.py
  • python/cuml/tests/test_trustworthiness.py

Comment thread python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
Comment thread python/cuml/cuml/explainer/tree_shap.pyx
Comment thread python/cuml/cuml/linear_model/linear_regression.pyx
Comment thread python/cuml/cuml/tsa/arima.pyx
@jcrist
jcrist force-pushed the deprecate-convert-dtype branch from 97c3aed to cc32c00 Compare June 30, 2026 19:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
python/cuml/cuml/internals/validation.py (1)

1131-1169: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

convert_dtype is silently dropped in the classification (return_classes) branch.

When return_classes is not False, check_y never forwards convert_dtype to the internal check_array call (line 1138), so an explicit convert_dtype=True/False passed by a classifier's fit() never triggers the deprecation FutureWarning here, unlike the regression branch (line 1170-1179). This makes the deprecation signal inconsistent depending on estimator type, and test_convert_dtype_deprecated doesn't cover this path.

♻️ Proposed fix
         if not isinstance(y, (cudf.DataFrame, cudf.Series)):
             y = check_array(
                 y,
+                convert_dtype=convert_dtype,
                 mem_type=None,
                 ensure_2d=False,
                 ensure_min_samples=0,
                 ensure_all_finite=False,
                 input_name="y",
             )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/internals/validation.py` around lines 1131 - 1169, The
classification path in check_y currently ignores convert_dtype when
return_classes is not False, so the deprecation warning path is skipped for
classifier fits. Update the check_array call inside the return_classes branch to
forward convert_dtype the same way the regression branch does, and keep the
behavior consistent across both paths in check_y so the FutureWarning is emitted
regardless of estimator type.
🧹 Nitpick comments (1)
python/cuml/cuml/internals/validation.py (1)

634-641: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add stacklevel to the deprecation warning.

Without stacklevel, the FutureWarning points at this internal frame in check_array rather than the caller's code, making it harder for users to locate where convert_dtype is still being passed.

♻️ Proposed fix
     if convert_dtype != "deprecated":
         warnings.warn(
             "`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.",
             FutureWarning,
+            stacklevel=2,
         )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cuml/cuml/internals/validation.py` around lines 634 - 641, Add a
stacklevel argument to the FutureWarning emitted in check_array’s convert_dtype
deprecation branch so the warning points to the caller instead of the internal
validation frame. Update the warnings.warn call in validation.py where
convert_dtype != "deprecated" to include an appropriate stacklevel value,
preserving the existing message and FutureWarning category.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@python/cuml/cuml/internals/validation.py`:
- Around line 1131-1169: The classification path in check_y currently ignores
convert_dtype when return_classes is not False, so the deprecation warning path
is skipped for classifier fits. Update the check_array call inside the
return_classes branch to forward convert_dtype the same way the regression
branch does, and keep the behavior consistent across both paths in check_y so
the FutureWarning is emitted regardless of estimator type.

---

Nitpick comments:
In `@python/cuml/cuml/internals/validation.py`:
- Around line 634-641: Add a stacklevel argument to the FutureWarning emitted in
check_array’s convert_dtype deprecation branch so the warning points to the
caller instead of the internal validation frame. Update the warnings.warn call
in validation.py where convert_dtype != "deprecated" to include an appropriate
stacklevel value, preserving the existing message and FutureWarning category.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1f2471f8-3a05-4d9f-92a9-ba5d3d6cea93

📥 Commits

Reviewing files that changed from the base of the PR and between 97c3aed and cc32c00.

📒 Files selected for processing (74)
  • python/cuml/cuml/cluster/agglomerative.pyx
  • python/cuml/cuml/cluster/dbscan.pyx
  • python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
  • python/cuml/cuml/cluster/kmeans.pyx
  • python/cuml/cuml/common/doc_utils.py
  • python/cuml/cuml/covariance/empirical_covariance.py
  • python/cuml/cuml/covariance/ledoit_wolf.py
  • python/cuml/cuml/dask/ensemble/randomforestclassifier.py
  • python/cuml/cuml/dask/ensemble/randomforestregressor.py
  • python/cuml/cuml/dask/manifold/umap.py
  • python/cuml/cuml/dask/neighbors/kneighbors_classifier.py
  • python/cuml/cuml/dask/neighbors/kneighbors_regressor.py
  • python/cuml/cuml/decomposition/incremental_pca.py
  • python/cuml/cuml/decomposition/pca.pyx
  • python/cuml/cuml/decomposition/tsvd.pyx
  • python/cuml/cuml/ensemble/randomforestclassifier.py
  • python/cuml/cuml/ensemble/randomforestregressor.py
  • python/cuml/cuml/experimental/linear_model/lars.pyx
  • python/cuml/cuml/explainer/tree_shap.pyx
  • python/cuml/cuml/internals/validation.py
  • python/cuml/cuml/kernel_ridge/kernel_ridge.py
  • python/cuml/cuml/linear_model/base.py
  • python/cuml/cuml/linear_model/elastic_net.py
  • python/cuml/cuml/linear_model/linear_regression.pyx
  • python/cuml/cuml/linear_model/logistic_regression.py
  • python/cuml/cuml/linear_model/mbsgd_classifier.py
  • python/cuml/cuml/linear_model/mbsgd_regressor.py
  • python/cuml/cuml/linear_model/ridge.pyx
  • python/cuml/cuml/manifold/t_sne.pyx
  • python/cuml/cuml/manifold/umap/umap.pyx
  • python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx
  • python/cuml/cuml/metrics/cluster/silhouette_score.pyx
  • python/cuml/cuml/metrics/confusion_matrix.py
  • python/cuml/cuml/metrics/kl_divergence.pyx
  • python/cuml/cuml/metrics/pairwise_distances.pyx
  • python/cuml/cuml/metrics/pairwise_kernels.py
  • python/cuml/cuml/metrics/trustworthiness.pyx
  • python/cuml/cuml/naive_bayes/naive_bayes.py
  • python/cuml/cuml/neighbors/kernel_density.pyx
  • python/cuml/cuml/neighbors/kneighbors_classifier.pyx
  • python/cuml/cuml/neighbors/kneighbors_classifier_mg.pyx
  • python/cuml/cuml/neighbors/kneighbors_regressor.pyx
  • python/cuml/cuml/neighbors/kneighbors_regressor_mg.pyx
  • python/cuml/cuml/neighbors/nearest_neighbors.pyx
  • python/cuml/cuml/neighbors/nearest_neighbors_mg.pyx
  • python/cuml/cuml/random_projection/random_projection.py
  • python/cuml/cuml/solvers/cd.pyx
  • python/cuml/cuml/solvers/qn.pyx
  • python/cuml/cuml/solvers/sgd.pyx
  • python/cuml/cuml/svm/linear.pyx
  • python/cuml/cuml/svm/linear_svc.py
  • python/cuml/cuml/svm/linear_svr.py
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/cuml/svm/svr.py
  • python/cuml/cuml/tsa/arima.pyx
  • python/cuml/cuml/tsa/auto_arima.pyx
  • python/cuml/cuml/tsa/seasonality.py
  • python/cuml/cuml/tsa/stationarity.pyx
  • python/cuml/tests/dask/test_dask_kneighbors_classifier.py
  • python/cuml/tests/dask/test_dask_kneighbors_regressor.py
  • python/cuml/tests/test_elastic_net.py
  • python/cuml/tests/test_kernel_density.py
  • python/cuml/tests/test_linear_regression.py
  • python/cuml/tests/test_logistic_regression.py
  • python/cuml/tests/test_metrics.py
  • python/cuml/tests/test_nearest_neighbors.py
  • python/cuml/tests/test_random_forest.py
  • python/cuml/tests/test_solver_attributes.py
  • python/cuml/tests/test_svm.py
  • python/cuml/tests/test_trustworthiness.py
  • python/cuml/tests/test_tsne.py
  • python/cuml/tests/test_umap.py
  • python/cuml/tests/test_validation.py
💤 Files with no reviewable changes (2)
  • python/cuml/tests/test_nearest_neighbors.py
  • python/cuml/tests/test_trustworthiness.py
✅ Files skipped from review due to trivial changes (10)
  • python/cuml/cuml/neighbors/nearest_neighbors_mg.pyx
  • python/cuml/tests/test_linear_regression.py
  • python/cuml/cuml/svm/linear.pyx
  • python/cuml/cuml/kernel_ridge/kernel_ridge.py
  • python/cuml/cuml/tsa/auto_arima.pyx
  • python/cuml/cuml/neighbors/kneighbors_classifier_mg.pyx
  • python/cuml/tests/dask/test_dask_kneighbors_classifier.py
  • python/cuml/cuml/random_projection/random_projection.py
  • python/cuml/tests/test_solver_attributes.py
  • python/cuml/tests/dask/test_dask_kneighbors_regressor.py
🚧 Files skipped from review as they are similar to previous changes (61)
  • python/cuml/cuml/neighbors/kneighbors_regressor_mg.pyx
  • python/cuml/cuml/tsa/stationarity.pyx
  • python/cuml/cuml/linear_model/ridge.pyx
  • python/cuml/cuml/tsa/seasonality.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/tests/test_elastic_net.py
  • python/cuml/cuml/svm/linear_svc.py
  • python/cuml/cuml/decomposition/tsvd.pyx
  • python/cuml/cuml/cluster/agglomerative.pyx
  • python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx
  • python/cuml/cuml/linear_model/linear_regression.pyx
  • python/cuml/cuml/experimental/linear_model/lars.pyx
  • python/cuml/cuml/explainer/tree_shap.pyx
  • python/cuml/cuml/metrics/confusion_matrix.py
  • python/cuml/cuml/linear_model/mbsgd_classifier.py
  • python/cuml/cuml/metrics/cluster/silhouette_score.pyx
  • python/cuml/cuml/covariance/empirical_covariance.py
  • python/cuml/cuml/dask/manifold/umap.py
  • python/cuml/cuml/svm/svr.py
  • python/cuml/cuml/linear_model/logistic_regression.py
  • python/cuml/cuml/neighbors/kneighbors_regressor.pyx
  • python/cuml/cuml/dask/ensemble/randomforestregressor.py
  • python/cuml/tests/test_random_forest.py
  • python/cuml/cuml/decomposition/pca.pyx
  • python/cuml/cuml/solvers/sgd.pyx
  • python/cuml/cuml/metrics/kl_divergence.pyx
  • python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
  • python/cuml/cuml/solvers/cd.pyx
  • python/cuml/cuml/dask/ensemble/randomforestclassifier.py
  • python/cuml/cuml/linear_model/elastic_net.py
  • python/cuml/cuml/linear_model/base.py
  • python/cuml/tests/test_svm.py
  • python/cuml/cuml/dask/neighbors/kneighbors_classifier.py
  • python/cuml/cuml/linear_model/mbsgd_regressor.py
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/neighbors/kneighbors_classifier.pyx
  • python/cuml/cuml/metrics/pairwise_kernels.py
  • python/cuml/cuml/svm/linear_svr.py
  • python/cuml/cuml/covariance/ledoit_wolf.py
  • python/cuml/cuml/ensemble/randomforestregressor.py
  • python/cuml/cuml/neighbors/kernel_density.pyx
  • python/cuml/cuml/solvers/qn.pyx
  • python/cuml/tests/test_tsne.py
  • python/cuml/cuml/manifold/t_sne.pyx
  • python/cuml/cuml/metrics/trustworthiness.pyx
  • python/cuml/cuml/ensemble/randomforestclassifier.py
  • python/cuml/cuml/decomposition/incremental_pca.py
  • python/cuml/cuml/cluster/dbscan.pyx
  • python/cuml/tests/test_kernel_density.py
  • python/cuml/cuml/metrics/pairwise_distances.pyx
  • python/cuml/tests/test_validation.py
  • python/cuml/cuml/dask/neighbors/kneighbors_regressor.py
  • python/cuml/cuml/tsa/arima.pyx
  • python/cuml/tests/test_logistic_regression.py
  • python/cuml/cuml/cluster/kmeans.pyx
  • python/cuml/cuml/common/doc_utils.py
  • python/cuml/cuml/naive_bayes/naive_bayes.py
  • python/cuml/cuml/neighbors/nearest_neighbors.pyx
  • python/cuml/cuml/manifold/umap/umap.pyx
  • python/cuml/tests/test_umap.py
  • python/cuml/tests/test_metrics.py

@betatim betatim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few cases where a function/method accepts convert_dtype but the argument doesn't get used in some branches/doesn't make its way to check_array. This means users don't get the deprecation warning, and in the future will get a (surprising) error.

The tricky part is, that we can't just thread this argument through (the obvious way to get a warning in all cases), because it can change what the code does for those who have been passing this currently ignored argument.

  • SVC.predict in the multiclass case
  • cuml.metrics.pairwise_distances(..., metric="nan_euclidean")
  • IncrementalPCA.transform() for dense inputs

Comment thread python/cuml/cuml/internals/validation.py
Comment thread python/cuml/cuml/metrics/pairwise_kernels.py
Comment thread python/cuml/tests/test_validation.py
Comment thread python/cuml/cuml/internals/validation.py
@betatim

betatim commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

We had some private discussion about the functions/methods that take convert_dtype but don't thread it through, so no warning will be raised. Conclusion: not worth disturbing the current state to add the warning. The number of people using these paths and the convert_dtype argument are likely very small.

@jcrist

jcrist commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 8817cd2 into NVIDIA:main Jul 1, 2026
100 of 101 checks passed
@jcrist
jcrist deleted the deprecate-convert-dtype branch July 1, 2026 15:00
@jcrist jcrist added breaking Breaking change and removed non-breaking Non-breaking change labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate and remove convert_dtype kwarg

4 participants