Repository navigation
Optimize GaussianNB.fit sufficient statistics - #316
Merged
Merged
Conversation
godofecht
force-pushed
the
fix/210-gaussian-nb-fit
branch
from
August 17, 2026 09:52
44f4b93 to
82a4061
Compare
This was referenced Aug 17, 2026
godofecht
marked this pull request as ready for review
August 17, 2026 10:05
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.
Progresses #210.
Rewrites GaussianNB.fit around cached class indices and two contiguous sufficient-statistics passes instead of repeatedly allocating temporary columns/value arrays and rescanning the dataset for every class × feature pair.
The new fit path preserves class ordering, priors, ddof=0 population variance semantics, and var_smoothing behavior. A dedicated regression test locks priors, means, variances, and fitted predictions on a deterministic fixture.
Measured scaled evidence versus the committed Flow baseline shows fit latency reductions of 55–64% (2.23×–2.80× faster) across all 100/1k/10k × 8/32-feature cases, with the self-baseline gate passing. Canonical parity/evidence workflows also passed on the implementation before the branch was rebased onto current main; fresh checks are running on the clean rebased head.
The unrelated native-wheel absolute-path CI blocker discovered during validation is already fixed on current main via #201, so this PR contains only the GaussianNB source and test changes.