refactor(naive_bayes): remove duplicated RealNumber trait bound - #423
Merged
Mec-iS merged 1 commit intoAug 10, 2026
Merged
Conversation
`GaussianNB` declared `TX: Number + RealNumber + RealNumber` in four places (the struct and its Display, SupervisedEstimator and Predictor impls). The repeated bound is a no-op, so this is purely cosmetic. rustfmt collapses the now-shorter generic lists onto one line.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #423 +/- ##
================================================
+ Coverage 45.59% 63.64% +18.05%
================================================
Files 93 95 +2
Lines 8034 8142 +108
================================================
+ Hits 3663 5182 +1519
+ Misses 4371 2960 -1411 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Mec-iS
approved these changes
Aug 10, 2026
Collaborator
|
thanks 👍 |
Collaborator
|
@seroze if you are interested in mechanistic interpretability, check out my post https://www.tuned.org.uk/posts/019_arrowspace_local_minima_walkthrough/ and |
Contributor
Author
Thanks man, will check this. I'm also planning to apply for https://sparai.org/projects/f26/ |
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.
Fixes #424
Checklist
Current behaviour
GaussianNBasks forTX: Number + RealNumber + RealNumber.RealNumberis listed twice, and it happens in four places: the struct itself, plus itsDisplay,SupervisedEstimatorandPredictorimpls.Saying it twice doesn't ask anything extra of
TX, so nothing is broken here. rustc compiles it without a word, and clippy has nothing to say about it either, which is presumably how it survived this long.It looks like it crept in by accident. Three of the four came with the v0.4 generics rewrite (52eb6ce), where the old single
T: RealNumberwas split intoTX/TY. The fourth was copy-pasted a few days later along with the newDisplayimpl (ba70bb9).New expected behaviour
Just
TX: Number + RealNumber. Same requirements onTX, same generated code, one less thing to read.Testing
No new tests, since there's no behaviour change to assert and no new code paths for coverage to reach. The existing
naive_bayestests still pass:cargo build— cleancargo clippy --all-features -- -D warnings— cleancargo test naive_bayes— 23 passed, 0 failedChange logs
Changed
RealNumberbound fromGaussianNBand itsDisplay,SupervisedEstimatorandPredictorimpls.