Repository navigation
FIX prevent catastrophic cancellation in r_regression (#11395) - #34834
FinalSunFlower wants to merge 3 commits into
Conversation
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
|
Hi maintainers, gentle ping on this PR when someone has a chance to review. |
|
Can you introduce yourself again? You used AI for all, so is there a human in the loop? |
|
Hi @lorentzenchr, Yes, absolutely—I am an ML engineer, and I am fully in the loop here. I disclosed AI assistance because I used it as an editor for docstrings and boilerplate formatting, but the technical work was driven and vetted by me:
Happy to discuss or adjust the implementation if you have any feedback! |
|
@cakedev0 ping as you might be interested in this one |
|
According to my AI tool, this is an AI contribution. I don't want to encourage this kind of behavior so I'm closing it. @lorentzenchr, feel free to open a PR if the fix actually looks good. DetailsFinalSunFlower: medium concernI'd rate this medium concern. The account is not a pure spam bot. It has kept working on a few projects over weeks, mainly orcasound (several merged PRs, issues it filed itself) and Greenstand, and it gets real merges (MONAI, pyterrier, cuML). But from 2026-08-28 to 2026-09-22 it ran a sweep through unrelated, high-profile repos, picking up old open issues one after another. The scikit-learn PR you were pinged on fits that pattern. The three strongest signals:
Key numbers
What reading the PRs showed#34834 ("FIX prevent catastrophic cancellation in r_regression")
How other maintainers reacted:
Caveats for this case
This is heuristic evidence for a human decision, not proof. Read the PR and the issue thread yourself before acting. For #34834, the technical points above (issue not ready for a PR, clamp-only fix with a misleading title, misplaced test file) are probably enough to decide on merit alone. Any action on the account itself on GitHub is yours to take. |
Reference Issues/PRs
Fixes #11395.
What does this implement/fix? Explain your changes.
r_regressioncomputes centered feature norms using a moment-based expression. Floating-point cancellation can make the mathematically non-negative centered sum of squares slightly negative for constant or near-constant columns, causing an invalid square root and propagating invalid correlations. This change clamps the intermediate squared norms to zero beforesqrt, preserving existing results for active non-constant features and keeping dense, CSR, and CSC inputs consistent. Regression tests cover constant features,force_finite=False, sparse formats, high-magnitude cancellation, and active-feature preservation.Introduce yourself
I am FinalSunFlower, contributing a numerically focused bug fix to scikit-learn's feature-selection utilities. I use scikit-learn for classical machine-learning workflows and was prompted by issue #11395 to improve the stability of
r_regressionon degenerate inputs.AI usage disclosure
I used AI assistance for:
Any other comments?
Local CPU validation passed for the targeted regression tests, the complete feature-selection test module, Ruff checks, and formatting checks. The changelog entry is included in
doc/whats_new/upcoming_changes/sklearn.feature_selection/34834.fix.rst.