You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds SEFR, a linear classifier that trains in one pass over the data with no iterations, learning rate or hyperparameters. Each feature is min-max scaled, the weight is (p − n)/(p + n) from the two class means, and the threshold is a class-size-weighted average of the mean scores. Multiclass is one-vs-rest.
machine_learning/sefr.r: sefr_fit, sefr_predict, sefr_decision_function, base R only, with header docs and runnable examples
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Multiclass training repeatedly scans all samples for each class, violating the documented complexity and becoming quadratic in sample count when the number of classes grows proportionally.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The shared input check accepts infinite feature values, allowing min-max scaling to produce invalid model parameters instead of rejecting non-finite input.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject non-finite values before min-max scaling
machine_learning/sefr.r:38
This check accepts Inf and -Inf, although min-max scaling cannot handle them. For example, fitting a feature containing c(0, 1, Inf, 2) with two classes computes Inf / Inf during scaling and returns invalid model parameters instead of reporting invalid input. Reject non-finite values in this shared helper so both fitting and prediction fail with a clear diagnostic.
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
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.
Description
Adds SEFR, a linear classifier that trains in one pass over the data with no iterations, learning rate or hyperparameters. Each feature is min-max scaled, the weight is (p − n)/(p + n) from the two class means, and the threshold is a class-size-weighted average of the mean scores. Multiclass is one-vs-rest.
machine_learning/sefr.r:sefr_fit,sefr_predict,sefr_decision_function, base R only, with header docs and runnable examplesDIRECTORY.md: one entry under Machine LearningReference: https://arxiv.org/abs/2006.04620 (I am the first author of the paper).
Validation
Rscripton R 4.1.0: iris training accuracy 0.90, 70/30 split test accuracy 0.84, versicolor vs virginica 0.93🤖 Generated with Claude Code