Skip to content

Remove deprecated sample_weight in naive bayes/sample_weights in hinge_loss - #8221

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
jcrist:remove-deprecations-2608
Jun 4, 2026
Merged

Remove deprecated sample_weight in naive bayes/sample_weights in hinge_loss#8221
rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
jcrist:remove-deprecations-2608

Conversation

@jcrist

@jcrist jcrist commented Jun 3, 2026

Copy link
Copy Markdown
Member

This removes:

  • The deprecated sample_weights alias in hinge_loss
  • The deprecated sample_weight arg to discrete naive bayes estimators

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 15:32
@jcrist jcrist added the improvement Improvement / enhancement to an existing function label Jun 3, 2026
@jcrist
jcrist requested a review from divyegala June 3, 2026 15:32
@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 commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

The only remaining deprecations to remove this release cycle are probability in SVC/LinearSVC. Since that one requires a larger effort (including letting us delete some C++) I'm splitting it out into a separate PR.

@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: 370b49fa-cd05-47f9-bcec-0c88562a9e6e

📥 Commits

Reviewing files that changed from the base of the PR and between e1b2740 and 6b38f08.

📒 Files selected for processing (5)
  • python/cuml/cuml/metrics/hinge_loss.py
  • python/cuml/cuml/naive_bayes/naive_bayes.py
  • python/cuml/tests/test_metrics.py
  • python/cuml/tests/test_naive_bayes.py
  • python/cuml/tests/test_sklearn_compatibility.py
💤 Files with no reviewable changes (4)
  • python/cuml/tests/test_sklearn_compatibility.py
  • python/cuml/cuml/metrics/hinge_loss.py
  • python/cuml/tests/test_metrics.py
  • python/cuml/tests/test_naive_bayes.py

📝 Walkthrough

Summary by CodeRabbit

Breaking Changes

  • Removed deprecated sample_weights parameter from hinge_loss() function; use sample_weight instead.
  • Removed deprecated sample_weight parameter from Naive Bayes fit() and partial_fit() methods in discrete implementations; sample weighting is no longer supported.

Walkthrough

This PR removes deprecated sample_weight parameter aliases and their associated deprecation-warning logic from the hinge_loss metric function and discrete Naive Bayes estimators. Corresponding tests validating the deprecated behavior are deleted, and sklearn compatibility expected-failure configurations are updated to reflect the removals.

Changes

Deprecation Cleanup for sample_weight Parameters

Layer / File(s) Summary
Hinge Loss: remove sample_weights deprecation
python/cuml/cuml/metrics/hinge_loss.py, python/cuml/tests/test_metrics.py
The sample_weights deprecated alias and its FutureWarning aliasing logic are removed from hinge_loss. The function signature now accepts only sample_weight, the warnings import is deleted, the docstring deprecation section is removed, and the test test_hinge_loss_sample_weights_deprecated is deleted.
Naive Bayes: remove sample_weight deprecation
python/cuml/cuml/naive_bayes/naive_bayes.py, python/cuml/tests/test_naive_bayes.py
The deprecated sample_weight parameter is removed from _BaseDiscreteNB.partial_fit, _BaseDiscreteNB.fit, and the internal _BaseDiscreteNB._partial_fit method. The warnings import is deleted, deprecation/unsupported-behavior logic is eliminated, method delegations are adjusted to omit sample_weight, and the test test_sample_weight_deprecated is deleted.
sklearn compatibility: update expected-failure configuration
python/cuml/tests/test_sklearn_compatibility.py
The XFAILS mappings for BernoulliNB, CategoricalNB, ComplementNB, and MultinomialNB are updated to remove all sample_weight-related expected-failure checks, leaving only check_estimator_tags_renamed and check_classifier_data_not_an_array.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • rapidsai/cuml#8060: The earlier PR introduces the deprecated sample_weights alias for hinge_loss and the sample_weight deprecation in Naive Bayes methods, which this PR removes.

Suggested labels

Cython / Python, breaking

Suggested reviewers

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

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 pull request title clearly and specifically describes the main changes: removing deprecated sample_weight in naive bayes and sample_weights in hinge_loss.
Description check ✅ Passed The pull request description is directly related to the changeset, listing the deprecated features being removed and referencing the related issue.
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.

Comment thread python/cuml/cuml/naive_bayes/naive_bayes.py
@jcrist

jcrist commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit af109cb into NVIDIA:main Jun 4, 2026
97 checks passed
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