Simplify reflect decorator - #8295
Conversation
Now that all modules have been converted to the new ingest system, we can remove `reflect(reset="type")` and revert to `reflect(reset=True)` everywhere. The meaning of `reflect(reset=True)` is the old meaning of `reflect(reset="type")`, which was only around to let us migrate incrementally. - Renames `reflect(reset="type")` -> `reflect(reset=True)` everywhere. - Removes all handling of `check_features` in the `reflect` decorator. - Removes no longer needed `cuml.accel` path for handling list/tuple inputs in the `reflect` decorator. Those just work now, and don't require extra handling or duplicate conversion here. - Updates the `ESTIMATOR_GUIDE.md` to reflect these changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request changes ChangesBoolean
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/internals/outputs.py`:
- Around line 461-476: The `reflect` decorator’s `reset` handling in
`outputs.py` still accepts truthy non-boolean values, so the bool-only contract
is not enforced. Add explicit validation in the `reflect` wrapper before `inner`
is defined to reject any `reset` value that is not a `bool`, and keep the
existing `model is None or array is None` validation for the true case. Use the
`reflect` function and its `reset` parameter as the main touchpoints so invalid
call sites like `reset="type"` fail immediately.
🪄 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: 7e230d66-2320-4bc4-8393-52033be52a84
📒 Files selected for processing (45)
python/cuml/cuml/_thirdparty/sklearn/preprocessing/_column_transformer.pypython/cuml/cuml/_thirdparty/sklearn/preprocessing/_data.pypython/cuml/cuml/_thirdparty/sklearn/preprocessing/_discretization.pypython/cuml/cuml/_thirdparty/sklearn/preprocessing/_function_transformer.pypython/cuml/cuml/_thirdparty/sklearn/preprocessing/_imputation.pypython/cuml/cuml/cluster/agglomerative.pyxpython/cuml/cuml/cluster/dbscan.pyxpython/cuml/cuml/cluster/hdbscan/hdbscan.pyxpython/cuml/cuml/cluster/kmeans.pyxpython/cuml/cuml/cluster/spectral_clustering.pyxpython/cuml/cuml/covariance/empirical_covariance.pypython/cuml/cuml/covariance/ledoit_wolf.pypython/cuml/cuml/decomposition/incremental_pca.pypython/cuml/cuml/decomposition/pca.pyxpython/cuml/cuml/decomposition/tsvd.pyxpython/cuml/cuml/experimental/linear_model/lars.pyxpython/cuml/cuml/internals/outputs.pypython/cuml/cuml/kernel_ridge/kernel_ridge.pypython/cuml/cuml/linear_model/elastic_net.pypython/cuml/cuml/linear_model/linear_regression.pyxpython/cuml/cuml/linear_model/logistic_regression.pypython/cuml/cuml/linear_model/mbsgd_classifier.pypython/cuml/cuml/linear_model/mbsgd_regressor.pypython/cuml/cuml/linear_model/ridge.pyxpython/cuml/cuml/manifold/spectral_embedding.pyxpython/cuml/cuml/manifold/t_sne.pyxpython/cuml/cuml/manifold/umap/umap.pyxpython/cuml/cuml/multiclass/multiclass.pypython/cuml/cuml/neighbors/kernel_density.pyxpython/cuml/cuml/neighbors/kneighbors_classifier.pyxpython/cuml/cuml/neighbors/kneighbors_regressor.pyxpython/cuml/cuml/neighbors/nearest_neighbors.pyxpython/cuml/cuml/preprocessing/_label.pypython/cuml/cuml/preprocessing/_target_encoder.pypython/cuml/cuml/preprocessing/label.pypython/cuml/cuml/random_projection/random_projection.pypython/cuml/cuml/solvers/cd.pyxpython/cuml/cuml/solvers/qn.pyxpython/cuml/cuml/solvers/sgd.pyxpython/cuml/cuml/svm/linear_svc.pypython/cuml/cuml/svm/linear_svr.pypython/cuml/cuml/svm/svc.pypython/cuml/cuml/svm/svr.pypython/cuml/tests/test_reflection.pywiki/python/ESTIMATOR_GUIDE.md
We previously were implicitly always exposing this namespace. For now lets keep doing it - it's not expensive to import (relative to other things).
|
/merge |
Now that all modules have been converted to the new ingest system, we can remove
reflect(reset="type")and revert toreflect(reset=True)everywhere. The meaning ofreflect(reset=True)is the old meaning ofreflect(reset="type"), which was only around to let us migrate incrementally.reflect(reset="type")back toreflect(reset=True)everywhere.check_featuresin thereflectdecorator.cuml.accelpath for handling list/tuple inputs in thereflectdecorator. Those just work now, and don't require extra handling or duplicate conversion here.ESTIMATOR_GUIDE.mdto reflect these changes.Part of #7428.