Skip to content

FIX Do the sparse incremental mean and variance update in float64 - #35260

Open
cakedev0 wants to merge 5 commits into
scikit-learn:mainfrom
cakedev0:sparse-float32-incr-mean-var
Open

cakedev0 wants to merge 5 commits into
scikit-learn:mainfrom
cakedev0:sparse-float32-incr-mean-var

Conversation

@cakedev0

@cakedev0 cakedev0 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Reference Issues/PRs

Found while looking at #5602 (see my comment there). It's a different bug: this one happens with values far below the float limits.

I don't think it's a super useful fix, but it doesn't make the code more complex so why not.

What does this implement/fix? Explain your changes.

_csr_mean_variance_axis0 and _csc_mean_variance_axis0 already accumulate in float64 but were rounding their result to float32. They now return their float64 accumulators, _incr_mean_variance_axis0 does the update in float64, and the public wrappers cast back to the input dtype. So the output dtypes don't change.

AI usage disclosure

I used AI assistance for:

  • Code generation
  • Research and understanding

@cakedev0 cakedev0 added the Low Priority Low priority issues and pull requests label Oct 29, 2026
cakedev0 and others added 3 commits October 29, 2026 08:15
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cakedev0
cakedev0 marked this pull request as ready for review October 29, 2026 07:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant