MAINT Remove unused _find_smallest_angle helper in _ridge.py - #34790
Merged
jeremiedbb merged 1 commit intoAug 25, 2026
Conversation
_find_smallest_angle located the intercept eigenvector in the old _RidgeGCV eigen-GCV path. That path was replaced by an explicit G^-1 intercept correction in _solve_eigen_gram, leaving this helper with no remaining callers. It is a private function, not referenced anywhere in the codebase, tests, or docs, and not exported. Ridge/RidgeCV behavior is unchanged. Co-Authored-By: Vinv-AI <[email protected]>
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
No issue - small dead-code cleanup. The helper was left behind when the eigen-GCV
intercept path moved to an explicit
G^-1correction in_solve_eigen_gram(#33020).What does this implement/fix? Explain your changes.
_find_smallest_angleused to find the intercept eigenvector in_RidgeGCV'seigen-GCV path. Once that path switched to computing the intercept correction
directly in
_solve_eigen_gram, nothing called it anymore. It's private,unexported, and grep finds it only at its own definition - no callers in the code,
tests, or docs.
So this just deletes the function (19 lines). Ridge and RidgeCV behave exactly the
same; there's no API with a caller to break.
Introduce yourself
I'm Anshul, working on Vinv - it traces running Python services to find dead code,
hotspots, and runtime errors without changing the source. scikit-learn is a
dependency in our own pipeline, so it goes through the same analysis. Vinv's
dead-code pass flagged
_find_smallest_angle: no callers in the traces we captured,no static references. I went and read the code, saw the eigen-GCV caller was already
gone, and sent this.
AI usage disclosure
Models: Composer 2.5 (via Cursor + VinvAI)
Prompt (paraphrased): act on Vinv's dead-code finding for
_find_smallest_angle,confirm it's genuinely unreferenced (no static references anywhere in code, tests,
or docs; not exported; no dynamic lookup by name; and its former eigen-GCV caller
was replaced by the
_solve_eigen_gramintercept correction), then delete it.AI transcript
_find_smallest_angleinsklearn/linear_model/_ridge.pyas unreferenced._find_smallest_angle→ only the definition site matched(code, tests, and docs).
__all__, and not re-exported.get_namespace) is still used elsewhere inthe module, so its import stays.
python -m py_compile sklearn/linear_model/_ridge.py→ compiles clean.Any other comments?
No changelog entry - it's an internal helper with no callers, so nothing user-facing
changes. I can add one if you'd rather. Verified locally that the module still
compiles and
get_namespaceis still used elsewhere.