FIX Raise TypeError when sparse input is not supported#7728
FIX Raise TypeError when sparse input is not supported#7728rapids-bot[bot] merged 10 commits intorapidsai:mainfrom
TypeError when sparse input is not supported#7728Conversation
This makes cuml more compatible with scikit-learn by raising the exception type that it expects.
📝 WalkthroughSummary by CodeRabbit
WalkthroughSparse-input handling in internals changed: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@python/cuml/tests/test_sklearn_compatibility.py`:
- Around line 702-704: The xfail rationale masks a tag-behavior mismatch:
scikit-learn's check_estimator_sparse_tag detects that input_tags.sparse=True
(via SparseInputTagMixin on GaussianRandomProjection and SparseRandomProjection)
but fit() rejects CSR sparse input; update the PR to either remove
SparseInputTagMixin (so input_tags.sparse is not declared) if sparse inputs
truly aren't supported, or amend the xfail rationale text to explicitly state
that the failure is due to the mismatch between input_tags.sparse and actual
fit() behavior (i.e., tag declares sparse support but fit() raises ValueError
for small datasets) so reviewers know the check is catching a tag inconsistency
rather than just the Johnson–Lindenstrauss small-dataset constraint.
|
/merge |
This makes cuml more compatible with scikit-learn by raising the exception type that it expects. Tackling one of the many xfail'ed checks in the compatibility testing. This changes the type from `NotImplementedError` to `TypeError`, which is technically a breaking change. However, I don't think this will effect many people as it is only a problem for those who are passing sparse data to an estimator that doesn't support it and then rely on catching the exception. I can't think of a way to handle this via a "deprecation cycle". It is a small change that fixes several estimators are the same time and gives us a better overview of those that truly fail this check. Authors: - Tim Head (https://github.com/betatim) - Simon Adorf (https://github.com/csadorf) Approvers: - Simon Adorf (https://github.com/csadorf) - Jim Crist-Harif (https://github.com/jcrist) URL: rapidsai#7728
This makes cuml more compatible with scikit-learn by raising the exception type that it expects.
Tackling one of the many xfail'ed checks in the compatibility testing.
This changes the type from
NotImplementedErrortoTypeError, which is technically a breaking change. However, I don't think this will effect many people as it is only a problem for those who are passing sparse data to an estimator that doesn't support it and then rely on catching the exception. I can't think of a way to handle this via a "deprecation cycle".It is a small change that fixes several estimators are the same time and gives us a better overview of those that truly fail this check.