PRF Ridge - centering trick for cholesky solver - #34793
Open
cakedev0 wants to merge 13 commits into
Open
Conversation
β¦ to svd
use_no_center_cholesky matched on solver in ("auto", "cholesky") but didn't
check the array namespace. With array API dispatch to a non-numpy namespace,
solver="auto" silently resolves to "svd" instead of "cholesky" (see
resolve_solver), which needs X to actually be centered. This left X
uncentered while running svd, causing
test_cross_val_predict_array_api_compliance[...-Ridge] failures on
array_api_strict and torch in CI.
cakedev0
commented
Aug 26, 2026
Comment on lines
+396
to
+399
| elif is_X_sparse and fit_intercept: | ||
| # when `fit_intercept=True`, `mean_variance_axis` will be called on X | ||
| # and it requires csr/csc format | ||
| return ["csr", "csc"] |
Contributor
Author
There was a problem hiding this comment.
Note to reviewers: this addition is needed because I now pass check_input=False to _preprocess_data which would have done this logic.
cakedev0
marked this pull request as ready for review
August 27, 2026 06:55
Contributor
Author
|
cc @antoinebaker, I was told you're the specialist of this kind of tricks π |
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
None, I started investigated for a speed gain while comparing speed/profiles with the scikit-learn-intelex (oneDAL) implementation.
What does this implement/fix? Explain your changes.
check_array(and to avoid a copy in the algebraic centering Cholesky path).Those relatively simple changes provide a speedups ranging from ~1.2x to 2x.
AI usage disclosure
I used AI assistance for:
Benchmarks
Benchmarks are run through the PR: probabl-ai/scikit-learn-benchmarks#31 (see bot comments with links to dashboards)
The benchmark cases are the same than the ones used to compare with scikit-learn-intelex, they are a mix of synthetic and real-world datasets.
On the intel-laptop, one case show a regression but it's a benchmark artifact: this case uses the dual path, which is not affected by this PR. And if you look at the granular timings, you'll see in both branches (main and this one) oscillate a lot.