ferrolearn-linear
Linear models for the ferrolearn machine learning framework. Validated against scikit-learn 1.8.0 head-to-head — see the workspace BENCHMARKS.md for the full report.
Algorithms
Regression
| Model | Description |
|---|---|
LinearRegression |
Ordinary Least Squares via Cholesky / QR fallback |
Ridge |
L2-regularized regression via Cholesky decomposition |
RidgeCV |
Ridge with built-in alpha cross-validation |
Lasso |
L1-regularized regression via coordinate descent |
LassoCV |
Lasso with alpha CV |
LassoLars |
Lasso via Least-Angle Regression |
Lars |
Least-Angle Regression |
OrthogonalMatchingPursuit |
Sparse coding via OMP |
ElasticNet / ElasticNetCV |
Combined L1/L2 regularization |
BayesianRidge |
Bayesian ridge with automatic regularization tuning |
ARDRegression |
Automatic Relevance Determination |
HuberRegressor |
Robust regression via IRLS with Huber loss |
QuantileRegressor |
L1-regularized quantile regression (sklearn-equivalent α scale) |
RANSACRegressor |
Robust regression with outlier rejection |
SGDRegressor |
Stochastic gradient descent regressor |
LinearSVR / NuSVR |
Linear / Nu Support Vector Regression |
IsotonicRegression |
Non-decreasing 1D regression |
Classification
| Model | Description |
|---|---|
LogisticRegression |
Binary and multiclass classification via L-BFGS |
LogisticRegressionCV |
Logistic regression with C cross-validation |
RidgeClassifier |
Ridge regression cast as a classifier |
LinearSVC |
Linear Support Vector Classifier (coordinate-Newton primal solver) |
NuSVC / SVC |
Kernel SVMs |
OneClassSVM |
Novelty / outlier detection |
LDA |
Linear Discriminant Analysis |
QDA |
Quadratic Discriminant Analysis |
SGDClassifier |
Stochastic gradient descent classifier |
Example
use ;
use ;
use array;
let x = array!;
let y = array!;
let model = new.with_alpha;
let fitted = model.fit.unwrap;
let predictions = fitted.predict.unwrap;
All models follow the compile-time safety pattern: unfitted structs implement
Fit, fitted structs implement Predict. Calling predict() on an unfitted
model is a compile error.
sklearn parity highlights (0.3.0)
LinearSVCwas rewritten with coordinate-Newton steps replacing fixed-step gradient descent — closed a -21pp accuracy gap at medium scale.QuantileRegressor'salphawas rescaled byn_samplesso it's numerically equivalent to scikit-learn'salpha.- All regressor and classifier defaults now match scikit-learn ≥ 1.4.
Float generics
All models are generic over F: Float + Send + Sync + 'static, supporting
both f32 and f64.
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.