Skip to content

Deprecate probability parameter on SVC and LinearSVC - #8089

Merged
rapids-bot[bot] merged 11 commits into
NVIDIA:release/26.06from
switch527:enh-svm-deprecate-probability
May 19, 2026
Merged

Deprecate probability parameter on SVC and LinearSVC#8089
rapids-bot[bot] merged 11 commits into
NVIDIA:release/26.06from
switch527:enh-svm-deprecate-probability

Conversation

@switch527

@switch527 switch527 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Closes #7982

Mirrors sklearn PR #32050 on cuml.SVC and cuml.LinearSVC. Sentinel + _effective_X property pattern, same as PR #7958. FutureWarning fires from fit when the user passes an explicit value.

Also fixes a latent bug in the accel proxy where _gpu_fit was reading self.probability truthily. Default SVC() on small data would have routed through the probability code path since the sentinel string is truthy.

@copy-pr-bot

copy-pr-bot Bot commented May 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Cython / Python Cython or Python issue label May 12, 2026
@csadorf

csadorf commented May 12, 2026

Copy link
Copy Markdown
Contributor

@switch527 Thank you for the contribution! Would you mind cleaning up the PR description a bit?

@csadorf csadorf added improvement Improvement / enhancement to an existing function breaking Breaking change labels May 12, 2026
@switch527

Copy link
Copy Markdown
Contributor Author

Sorry for the original PR body. It had template-y ### Changes / ### Verification sections that I should have caught before opening. I pushed a rewrite a few minutes ago, and the live body should be much cleaner now if you reload.

One label note, the PR is currently tagged breaking + improvement, but the deprecation should be non-breaking since the sentinel default preserves prior behavior (existing code just gets a warning). Could you swap when you have a moment?

@csadorf

csadorf commented May 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating, but the description is still overly verbose, just focus on the high-level changes we don't need a detailed prose of all changes. We label PRs that introduce a deprecation also as breaking.

@switch527

Copy link
Copy Markdown
Contributor Author

Got it, cut it down. New body is up.

The breaking tag is noted. Thanks for the clarification.

@csadorf

csadorf commented May 12, 2026

Copy link
Copy Markdown
Contributor

/ok to test 9a758ee

@switch527
switch527 force-pushed the enh-svm-deprecate-probability branch 2 times, most recently from a4ac617 to 5646958 Compare May 13, 2026 01:32
@switch527
switch527 force-pushed the enh-svm-deprecate-probability branch from 5646958 to 8a903af Compare May 14, 2026 04:09
Comment thread python/cuml/cuml/accel/_overrides/sklearn/svm.py Outdated
Comment thread python/cuml/cuml/svm/linear_svc.py Outdated
@switch527
switch527 force-pushed the enh-svm-deprecate-probability branch 2 times, most recently from e23d5dd to 04abb77 Compare May 14, 2026 23:25
@switch527

Copy link
Copy Markdown
Contributor Author

@jcrist, Heads-up: validate-release-target is failing because the PR's Release
field still says 26.06. Could you bump it to 26.08?

@switch527

Copy link
Copy Markdown
Contributor Author

@jcrist , code currently says 26.10. Did you mean the next release (now 26.10 after the 26.08 bump) or literally 26.08?

@csadorf

csadorf commented May 15, 2026

Copy link
Copy Markdown
Contributor

@jcrist , code currently says 26.10. Did you mean the next release (now 26.10 after the 26.08 bump) or literally 26.08?

I've updated it.

@switch527

Copy link
Copy Markdown
Contributor Author

Thanks. So removal stays at 26.10 (one cycle after the 26.08 deprecation), code already reads that way, leaving the docstrings as-is.

@switch527
switch527 requested a review from jcrist May 15, 2026 20:50
@csadorf

csadorf commented May 15, 2026

Copy link
Copy Markdown
Contributor

Actually, I think we should get this into the 26.06 release. Please rebase this branch on release/26.06 and update the relevant deprecation notices.

@switch527

Copy link
Copy Markdown
Contributor Author
image

@switch527
switch527 force-pushed the enh-svm-deprecate-probability branch from 9efe249 to 44f43bb Compare May 16, 2026 05:35
@switch527
switch527 changed the base branch from main to release/26.06 May 16, 2026 05:35
@switch527
switch527 marked this pull request as ready for review May 16, 2026 05:35
@switch527
switch527 requested a review from a team as a code owner May 16, 2026 05:35
@switch527
switch527 requested a review from csadorf May 16, 2026 05:35
@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4a3cc590-d8e6-4768-8643-baf6d6eeaf76

📥 Commits

Reviewing files that changed from the base of the PR and between 553f48e and 9c43ad3.

📒 Files selected for processing (1)
  • python/cuml/cuml_accel_tests/upstream/pytest.ini
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/cuml/cuml_accel_tests/upstream/pytest.ini

📝 Walkthrough

Summary by CodeRabbit

  • Deprecated Features

    • The probability parameter in SVC and LinearSVC is deprecated; setting it will emit a FutureWarning. Use CalibratedClassifierCV(..., ensemble=False) instead.
  • Behavior

    • GPU acceleration no longer applies when probability=True; handling of the deprecation sentinel is version-aware to preserve compatibility.
  • Documentation

    • Limitations updated to recommend the calibrated-classifier alternative and note non-acceleration for probability=True.
  • Tests

    • Test suite updated to filter and validate the new deprecation warnings and adjusted behavior.

Walkthrough

Deprecates probability for SVC and LinearSVC with a "deprecated" sentinel, introduces _effective_probability and SKLEARN_19 handling, removes accel per-class sample-count restriction, exports effective value to sklearn internals, updates docs, and adjusts tests and warning filters.

Changes

SVC/LinearSVC probability parameter deprecation

Layer / File(s) Summary
LinearSVC probability deprecation
python/cuml/cuml/svm/linear_svc.py
Constructor default changed to probability="deprecated", adds _effective_probability mapping sentinel→False, fit() emits FutureWarning when probability explicitly set, and all internal logic (solver arg, predict branching, @available_if) now uses _effective_probability.
SVC probability deprecation with sklearn version handling
python/cuml/cuml/svm/svc.py
Adds SKLEARN_19 detection, constructor default probability="deprecated", _effective_probability property, fit() warns only when explicit, pins inner clones to sentinel, and updates CPU↔GPU param translation (from_sklearn rejects probability=True, as_sklearn chooses value based on SKLEARN_19).
SVMBase export and accel override updates
python/cuml/cuml/svm/svm_base.pyx, python/cuml/cuml/accel/_overrides/sklearn/svm.py
Export fitted _effective_probability instead of raw probability; accel override removes per-class sample-count restriction for probability=True and updates sentinel-handling comments.
Documentation: limitations and migration guidance
docs/source/cuml-accel/limitations.rst
Replaces prior sample-count fallback text with deprecation notice and recommends sklearn.calibration.CalibratedClassifierCV(SVC(), ensemble=False) as the supported alternative to avoid CPU fallback.
Sklearn import/export integration test updates
python/cuml/tests/test_sklearn_import_export.py
test_svc now excludes probability from round-trip checks; when probability=True it validates predict_proba via converted sklearn model and expects UnsupportedOnGPU when importing sklearn SVC with probability=True.
Deprecation warning test suite
python/cuml/tests/test_svm.py
Adds module-level warning filter and new tests asserting FutureWarning emission semantics: explicit use warns, default sentinel does not, and warning happens once per outer fit.
Test warning filter updates
multiple test modules and CI config (python/cuml/cuml_accel_tests/..., python/cuml/tests/*, pytest.ini)
Add pytest.mark.filterwarnings and module-level pytestmark entries to suppress the probability deprecation FutureWarning during test runs; TODO comments mark future removal.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • rapidsai/cuml#8126: Both PRs update the same test_svc_probability warning filters in python/cuml/cuml_accel_tests/integration/test_svc.py to suppress scikit-learn/cuML SVC(probability=...) deprecation FutureWarnings.
  • rapidsai/cuml#7981: Both PRs modify the same SVM probability deprecation handling by recognizing scikit-learn’s "deprecated" sentinel and wiring it through cuML via _effective_probability, with corresponding test updates.

Suggested labels

cuml-accel, sklearn-api-compat, algo: svm

Suggested reviewers

  • csadorf
  • jcrist
  • betatim
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: deprecating the probability parameter on SVC and LinearSVC classes.
Description check ✅ Passed The description is directly related to the changeset, explaining the deprecation mirrors sklearn PR #32050, uses a sentinel pattern from PR #7958, and notes a latent bug fix in the accel proxy.
Linked Issues check ✅ Passed The PR successfully addresses issue #7982 by deprecating the probability parameter on SVC and LinearSVC, implementing the sentinel+_effective_probability pattern, emitting FutureWarnings, and fixing the accel proxy bug.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the probability deprecation: updating documentation, adding sentinel defaults, implementing _effective_probability properties, updating tests, and fixing the related accel proxy bug.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@jcrist

jcrist commented May 19, 2026

Copy link
Copy Markdown
Member

Thanks @switch527! This mostly looks good-to-go! I'm going to fix up the merge conflict, push up a few small tweaks, and try to shepherd this through CI to get it in for the upcoming release.

switch527 and others added 9 commits May 19, 2026 11:07
Mirrors the sklearn 1.9 deprecation (sklearn PR #32050). cuml's SVC
and LinearSVC now default `probability="deprecated"`; fit() emits a
FutureWarning when the user passed an explicit value. Internal call
sites read the resolved value through a new `_effective_probability`
property. The recommended replacement is
`CalibratedClassifierCV(estimator(), ensemble=False)` from
`sklearn.calibration`.

Closes NVIDIA#7982.
Per review, this lands in 26.06 rather than 26.08-dev. Shift the
deprecation notices accordingly: deprecated-in 26.08 to 26.06,
removed-in 26.10 to 26.08, across the SVC and LinearSVC docstrings,
the fit-time FutureWarning text, and the accel upstream pytest.ini
filter-removal reminder.
The deprecation retarget shifted removal from 26.10 to 26.08; the
filter cleanup reminders in the test tree still pointed at 26.10.
The accel integration test falls back to native sklearn, whose own
FutureWarning says "was deprecated"; widen that one filter to match
both. Anchor the direct-path matchers on the cuml-specific tail so
they cannot accidentally pass on an unrelated FutureWarning.
@jcrist
jcrist force-pushed the enh-svm-deprecate-probability branch from 44f43bb to 1ae8806 Compare May 19, 2026 16:47

@jcrist jcrist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your work!

@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: 2

🤖 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 `@docs/source/cuml-accel/limitations.rst`:
- Around line 510-514: Replace the incorrect reference to
sklearn.calibration.CalibratedClassifier with the correct public class
CalibratedClassifierCV in the documentation text; update the sentence that
currently mentions "wrapping SVC with sklearn.calibration.CalibratedClassifier"
to instead say "wrapping SVC with CalibratedClassifierCV" and ensure the example
remains CalibratedClassifierCV(SVC(), ensemble=False) so the class name is
consistent with the example and public API.

In `@python/cuml/cuml/svm/svc.py`:
- Around line 114-117: The docstring and user-facing deprecation warning for the
SVC `probability` parameter are inconsistent with the PR timeline; update all
occurrences that mention removal in "26.08" or the deprecated directive
"26.06"/"26.08" to the agreed removal version "26.10". Specifically edit the
deprecated directive and message strings in python/cuml/cuml/svm/svc.py (the SVC
class/docstring and any warnings triggered for the `probability` parameter) and
also change the matching strings around lines referenced (e.g., the other
instance at lines ~461-463) so both the `.. deprecated::` directive and the
warning text use "26.10".
🪄 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: c77bb940-48d8-40a1-bcc1-c1e20368a019

📥 Commits

Reviewing files that changed from the base of the PR and between 44f43bb and 1ae8806.

📒 Files selected for processing (14)
  • docs/source/cuml-accel/limitations.rst
  • python/cuml/cuml/accel/_overrides/sklearn/svm.py
  • python/cuml/cuml/svm/linear_svc.py
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/cuml_accel_tests/integration/test_svc.py
  • python/cuml/cuml_accel_tests/upstream/pytest.ini
  • python/cuml/tests/explainer/test_explainer_kernel_shap.py
  • python/cuml/tests/explainer/test_explainer_permutation_shap.py
  • python/cuml/tests/test_base.py
  • python/cuml/tests/test_linear_svm.py
  • python/cuml/tests/test_pickle.py
  • python/cuml/tests/test_sklearn_import_export.py
  • python/cuml/tests/test_svm.py
🚧 Files skipped from review as they are similar to previous changes (12)
  • python/cuml/tests/test_pickle.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/tests/test_linear_svm.py
  • python/cuml/tests/explainer/test_explainer_permutation_shap.py
  • python/cuml/cuml_accel_tests/integration/test_svc.py
  • python/cuml/tests/test_svm.py
  • python/cuml/cuml/svm/linear_svc.py
  • python/cuml/tests/test_base.py
  • python/cuml/cuml/accel/_overrides/sklearn/svm.py
  • python/cuml/cuml_accel_tests/upstream/pytest.ini
  • python/cuml/tests/test_sklearn_import_export.py
  • python/cuml/tests/explainer/test_explainer_kernel_shap.py

Comment thread docs/source/cuml-accel/limitations.rst
Comment thread python/cuml/cuml/svm/svc.py
@jcrist

jcrist commented May 19, 2026

Copy link
Copy Markdown
Member

/ok to test 553f48e

@jcrist

jcrist commented May 19, 2026

Copy link
Copy Markdown
Member

/ok to test 9c43ad3

@jcrist

jcrist commented May 19, 2026

Copy link
Copy Markdown
Member

/merge

@rapids-bot
rapids-bot Bot merged commit 1df5fa9 into NVIDIA:release/26.06 May 19, 2026
202 of 230 checks passed
@csadorf

csadorf commented May 20, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot to both of you for bringing this over the finish line!

@switch527

Copy link
Copy Markdown
Contributor Author

Happy to help!

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.

FEA Deprecate probability constructor argument for SVC and friends

5 participants