A few sklearn compat test fixes - #8366
Conversation
|
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)
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes update sklearn-compatible input validation, StandardScaler sample-count handling, KNeighborsRegressor metadata, and estimator compatibility expectations across PCA, TruncatedSVD, TSNE, UMAP, ensemble, linear, neighbor, and preprocessing checks. ChangesScikit-learn compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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/_thirdparty/sklearn/preprocessing/_data.py`:
- Around line 774-777: The scalar expansion in StandardScaler.partial_fit()
currently coerces fractional n_samples_seen_ values to int64. Preserve the
original scalar’s dtype when creating the broadcast array, and add an interop
regression test covering a migrated weighted StandardScaler resumed via
partial_fit().
In `@python/cuml/cuml/decomposition/pca.pyx`:
- Around line 482-483: PCA input validation currently rejects valid
single-feature datasets through ensure_min_features=2. Update the validation
configuration in the PCA fitting path to allow one feature, while retaining the
minimum sample requirement, so PCA(n_components=1) accepts shape (n_samples, 1)
input.
In `@python/cuml/cuml/decomposition/tsvd.pyx`:
- Around line 316-317: The TruncatedSVD validation currently rejects valid
one-row inputs via ensure_min_samples=2. In the TruncatedSVD input validation
logic, remove the sample minimum while retaining ensure_min_features=2, unless
the solver explicitly requires otherwise; add a regression test covering
fit_transform on a single-sample matrix.
In `@python/cuml/cuml/manifold/t_sne.pyx`:
- Around line 598-599: The TSNE input validation currently rejects valid
single-feature data via ensure_min_features=2. In the TSNE validation call near
ensure_min_samples, remove the ensure_min_features restriction so
one-dimensional inputs are accepted, and add or update coverage for a 1-feature
TSNE input.
In `@python/cuml/tests/test_sklearn_compatibility.py`:
- Around line 212-215: Restrict the KNeighborsRegressor exception for
check_regressor_multioutput to the float32-versus-float64 dtype assertion only,
rather than xfail-ing the entire check. Preserve or add an explicit assertion
for multi-output prediction shape so shape regressions cannot be hidden.
🪄 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: 7e0e4bc3-5a1e-4db8-8fc0-635272809379
📒 Files selected for processing (7)
python/cuml/cuml/_thirdparty/sklearn/preprocessing/_data.pypython/cuml/cuml/decomposition/pca.pyxpython/cuml/cuml/decomposition/tsvd.pyxpython/cuml/cuml/manifold/t_sne.pyxpython/cuml/cuml/neighbors/kneighbors_regressor.pyxpython/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yamlpython/cuml/tests/test_sklearn_compatibility.py
💤 Files with no reviewable changes (1)
- python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml
|
/merge |
A few tiny sklearn compat test fixups.
PCA/TruncatedSVD/TSNEKNeighborsRegressoras multi-outputStandardScalerlogicAt this point most of our remaining xfails are statistical issues with sample weights (sklearn has these too for several estimators, getting these correct is an ongoing process).