Skip to content

Optimize GaussianNB.fit sufficient statistics - #316

Merged
godofecht merged 2 commits into
mainfrom
fix/210-gaussian-nb-fit
Aug 17, 2026
Merged

godofecht merged 2 commits into
mainfrom
fix/210-gaussian-nb-fit

Conversation

@godofecht

@godofecht godofecht commented Aug 17, 2026 •

Copy link
Copy Markdown
Owner

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.

@godofecht godofecht changed the title Optimize GaussianNB.fit sufficient statistics Optimize GaussianNB.fit and unblock native wheel CI Aug 17, 2026
@godofecht
godofecht force-pushed the fix/210-gaussian-nb-fit branch from 44f4b93 to 82a4061 Compare August 17, 2026 09:52
@godofecht godofecht changed the title Optimize GaussianNB.fit and unblock native wheel CI Optimize GaussianNB.fit sufficient statistics Aug 17, 2026
@godofecht
godofecht marked this pull request as ready for review August 17, 2026 10:05
@godofecht
godofecht merged commit 8551104 into main Aug 17, 2026
@godofecht
godofecht deleted the fix/210-gaussian-nb-fit branch August 19, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant