Skip to content

Remove deprecated probability argument to SVC - #8223

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
jcrist:remove-deprecated-probability
Jun 4, 2026
Merged

Remove deprecated probability argument to SVC#8223
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
jcrist:remove-deprecated-probability

Conversation

@jcrist

@jcrist jcrist commented Jun 3, 2026

Copy link
Copy Markdown
Member

This removes the deprecated probability argument to SVC.

Part of #8220.

@jcrist jcrist self-assigned this Jun 3, 2026
@jcrist
jcrist requested a review from a team as a code owner June 3, 2026 16:50
@jcrist jcrist added the improvement Improvement / enhancement to an existing function label Jun 3, 2026
@jcrist
jcrist requested a review from dantegd June 3, 2026 16:50
@jcrist jcrist added the non-breaking Non-breaking change label Jun 3, 2026
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Jun 3, 2026
@jcrist
jcrist force-pushed the remove-deprecated-probability branch from b2e6871 to 3c364bb Compare June 3, 2026 16:55

@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 review.

I'll open a stacked PR to remove the parameter from LinearSVC. That one can also rip out some C++, so keeping it separate to ease review makes mores sense to me.

assert model.n_iter_ == 10


@pytest.mark.parametrize("explicit_value", [True, 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.

These tests were in test_svm.py even though they tested LinearSVC. I've temporarily moved them here so I could be more certain I'd fixed all the warnings in SVC in this PR. In the follow-up removing probability from LinearSVC I'll rip these out.

assert intersection_len > average_len / 8


def compare_probabilistic_svm(

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 is now longer used.


# rapids-pre-commit-hooks: disable-next-line
# TODO(26.08): Remove once `probability` is removed from cuml.svm.SVC.
# TODO: remove once we only support sklearn >= 1.9

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.

We do want to keep this test around to check plumbing for the fallback, the TODO to remove has been updated.

The filterwarnings below are to ignore warnings generated from sklearn on versions where they've deprecated probability.

@coderabbitai

coderabbitai Bot commented Jun 3, 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: 19497943-d555-4b3c-8b64-d7f455d3a66d

📥 Commits

Reviewing files that changed from the base of the PR and between b2e6871 and 3c364bb.

📒 Files selected for processing (11)
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/cuml/testing/utils.py
  • python/cuml/cuml_accel_tests/integration/test_svc.py
  • 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 with no reviewable changes (1)
  • python/cuml/cuml/testing/utils.py
✅ Files skipped from review due to trivial changes (1)
  • python/cuml/cuml_accel_tests/integration/test_svc.py
🚧 Files skipped from review as they are similar to previous changes (5)
  • python/cuml/tests/test_base.py
  • python/cuml/tests/test_linear_svm.py
  • python/cuml/tests/test_sklearn_import_export.py
  • python/cuml/cuml/svm/svc.py
  • python/cuml/tests/test_pickle.py

📝 Walkthrough

Summary by CodeRabbit

  • Breaking Changes

    • SVC no longer supports probability-based predictions: the probability constructor option and predict_proba()/predict_log_proba() are removed.
  • Improvements

    • Expanded and hardened test coverage for precomputed-kernel SVC/SVR (multiclass, kernel shapes, and related edge cases).
    • Tests/refactors aligned classifier calibration and import/export paths to the updated SVC behavior.

Walkthrough

Removes SVC's deprecated probability support: constructor flag and internal state, _fit_proba, predict_proba/predict_log_proba. CPU↔GPU attribute export/import updated to omit probability arrays. Tests refactored to remove probability parametrization and add precomputed-kernel coverage.

Changes

SVC probability removal

Layer / File(s) Summary
SVC API and parameter handling
python/cuml/cuml/svm/svc.py
SVC.__init__ no longer accepts probability. predict_proba, predict_log_proba, and _fit_proba removed. _get_param_names, _params_from_cpu, and _params_to_cpu no longer propagate probability; fit/predict branches simplified.
SVMBase attribute synchronization
python/cuml/cuml/svm/svm_base.pyx
_attrs_from_cpu omits _probA/_probB; _attrs_to_cpu always emits empty _probA/_probB arrays and _effective_probability=False. _fit no longer initializes probability arrays.
Test utilities and coverage cleanup
python/cuml/cuml/testing/utils.py, python/cuml/tests/test_base.py, python/cuml/tests/test_pickle.py, python/cuml/tests/test_svm.py, python/cuml/tests/test_sklearn_import_export.py, python/cuml/tests/test_linear_svm.py, python/cuml/tests/explainer/test_explainer_kernel_shap.py, python/cuml/tests/explainer/test_explainer_permutation_shap.py, python/cuml/cuml_accel_tests/integration/test_svc.py
Removed compare_probabilistic_svm helper. Tests updated to instantiate classifiers without probability, SHAP tests wrap classifiers in CalibratedClassifierCV, pickle/import-export/tests drop probability branches, and a new precomputed-kernel test suite was added for SVC/SVR. LinearSVC tests assert FutureWarning behavior when probability is explicitly provided.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • rapidsai/cuml#7981: Both PRs modify cuML’s SVC/scikit-learn probability/_effective_probability plumbing—main PR removes deprecated probability support while the retrieved PR adjusts scikit-learn 1.9 sentinel handling and CPU↔GPU attribute serialization for _effective_probability.
  • rapidsai/cuml#8089: The retrieved PR’s deprecation-sentinel work for SVC/LinearSVC (including changes to SVMBase._attrs_to_cpu and probability-related accel gating) directly overlaps with the main PR’s probability-deprecation/probability-state plumbing changes.
  • rapidsai/cuml#8138: Both PRs make tightly connected code changes to cuML’s SVM probability/deprecation handling—shared updates to SVC/LinearSVC probability sentinel behavior and SVMBase _effective_probability/probability attribute export.

Suggested labels

sklearn-api-compat, algo: svm

Suggested reviewers

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

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.12% 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 'Remove deprecated probability argument to SVC' directly and clearly describes the main change across all modified files—removing the deprecated probability parameter from the SVC class.
Description check ✅ Passed The description states the PR removes the deprecated probability argument to SVC and references the parent issue #8220, which is directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@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/tests/test_svm.py (1)

891-912: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Don't bake the default multiclass precomputed path in as a known failure.

This test codifies that SVC(kernel="precomputed") still breaks for multiclass under the default decision_function_shape="ovo". Since the public API in python/cuml/cuml/svm/svc.py still advertises kernel="precomputed" and still defaults decision_function_shape to "ovo", users will hit this on the default path. Please either make the OvO precomputed flow work, or reject that combination up front with a targeted validation error instead of the current late "square" failure.

🤖 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_svm.py` around lines 891 - 912, The test reveals that
SVC(kernel="precomputed") with the default decision_function_shape="ovo" results
in a late "square" error; fix by adding an explicit validation in the SVC
implementation (e.g., in SVC.__init__ or SVC.fit in python/cuml/cuml/svm/svc.py)
that checks if kernel=="precomputed" and decision_function_shape=="ovo" and
immediately raises a clear ValueError informing the user that OvO is not
supported with precomputed kernels (or alternatively implement proper OvO
handling for precomputed kernels), so callers like
test_svc_precomputed_multiclass_ovo_fails and runtime users get an early,
targeted error instead of the cryptic matrix "square" failure.
🤖 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/tests/test_svm.py`:
- Around line 891-912: The test reveals that SVC(kernel="precomputed") with the
default decision_function_shape="ovo" results in a late "square" error; fix by
adding an explicit validation in the SVC implementation (e.g., in SVC.__init__
or SVC.fit in python/cuml/cuml/svm/svc.py) that checks if kernel=="precomputed"
and decision_function_shape=="ovo" and immediately raises a clear ValueError
informing the user that OvO is not supported with precomputed kernels (or
alternatively implement proper OvO handling for precomputed kernels), so callers
like test_svc_precomputed_multiclass_ovo_fails and runtime users get an early,
targeted error instead of the cryptic matrix "square" failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5f1a6f04-b3c0-4992-8034-10870ebac856

📥 Commits

Reviewing files that changed from the base of the PR and between cedcf17 and b2e6871.

📒 Files selected for processing (10)
  • python/cuml/cuml/svm/svc.py
  • python/cuml/cuml/svm/svm_base.pyx
  • python/cuml/cuml/testing/utils.py
  • 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 with no reviewable changes (1)
  • python/cuml/cuml/testing/utils.py

@dantegd dantegd 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.

lgtm

@jcrist

jcrist commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 583e79e into NVIDIA:main Jun 4, 2026
102 checks passed
@jcrist
jcrist deleted the remove-deprecated-probability branch June 4, 2026 18:17
rapids-bot Bot pushed a commit that referenced this pull request Jun 4, 2026
This removes the deprecated `probability` argument to `LinearSVC`, along with all supporting code (python and C++).

Currently stacked on #8223.

Last part of #8220. Fixes #8220.

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #8224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants