Skip to main content

Crate ferrolearn_linear

Crate ferrolearn_linear 

Source
Expand description

§ferrolearn-linear

Linear models for the ferrolearn machine learning framework.

This crate provides implementations of the most common linear models for both regression and classification tasks:

  • LinearRegression — Ordinary Least Squares via QR decomposition
  • Ridge — L2-regularized regression via Cholesky decomposition
  • Lasso — L1-regularized regression via coordinate descent
  • ElasticNet — Combined L1/L2 regularization via coordinate descent
  • BayesianRidge — Bayesian Ridge with automatic regularization tuning
  • HuberRegressor — Robust regression via IRLS with Huber loss
  • LogisticRegression — Binary and multiclass classification via L-BFGS

All models implement the ferrolearn_core::Fit and ferrolearn_core::Predict traits, and produce fitted types that implement ferrolearn_core::introspection::HasCoefficients.

§Design

Each model follows the compile-time safety pattern:

  • The unfitted struct (e.g., LinearRegression<F>) holds hyperparameters and implements Fit.
  • Calling fit() produces a new fitted type (e.g., FittedLinearRegression<F>) that implements Predict.
  • Calling predict() on an unfitted model is a compile-time error.

§Pipeline Integration

All models implement PipelineEstimator for f64, allowing them to be used as the final step in a Pipeline.

§Float Generics

All models are generic over F: num_traits::Float + Send + Sync + 'static, supporting both f32 and f64.

Re-exports§

pub use bayesian_ridge::BayesianRidge;
pub use bayesian_ridge::FittedBayesianRidge;
pub use elastic_net::ElasticNet;
pub use elastic_net::FittedElasticNet;
pub use huber_regressor::FittedHuberRegressor;
pub use huber_regressor::HuberRegressor;
pub use lasso::FittedLasso;
pub use lasso::Lasso;
pub use lda::FittedLDA;
pub use lda::LDA;
pub use linear_regression::FittedLinearRegression;
pub use linear_regression::LinearRegression;
pub use logistic_regression::FittedLogisticRegression;
pub use logistic_regression::LogisticRegression;
pub use ridge::FittedRidge;
pub use ridge::Ridge;
pub use sgd::FittedSGDClassifier;
pub use sgd::FittedSGDRegressor;
pub use sgd::SGDClassifier;
pub use sgd::SGDRegressor;

Modules§

bayesian_ridge
Bayesian Ridge Regression.
elastic_net
ElasticNet regression (combined L1 and L2 regularization).
huber_regressor
Huber Regressor — robust regression via IRLS.
lasso
Lasso regression (L1-regularized linear regression).
lda
Linear Discriminant Analysis (LDA).
linear_regression
Ordinary Least Squares linear regression.
logistic_regression
Logistic regression classifier.
ridge
Ridge regression (L2-regularized linear regression).
sgd
Stochastic Gradient Descent (SGD) linear models.