Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Describe your change
This adds SEFR, a linear classifier that trains in one pass over the data. There's nothing to tune: no iterations, no learning rate. Each weight comes straight from the class means of a feature, w = (p - n) / (p + n), and the threshold is a weighted average of the two classes' mean scores. With more than two classes it runs one-vs-rest.
I wrote the original paper (https://arxiv.org/abs/2006.04620). Most people use SEFR on microcontrollers. ST ships it in NanoEdge AI Studio, where their stats show it picked as the best model in 6% of classification projects since 2025, and Arm merged it into CMSIS-DSP this November. In this folder it sits close to
gaussian_naive_bayes.pyandlinear_discriminant_analysis.py, since all three learn from class statistics only.The doctests walk through a small example by hand, then cover a three-class case and the error cases. Locally ruff, codespell and ty are clean, and the doctests pass with
pytest --doctest-modules --iterations=8 --parallel-threads=auto. Running the file prints the accuracy on an iris train/test split (0.87).Checklist
I wrote this with help from Claude Code, then reviewed and tested it myself.