ferrolearn-core
Core traits, error types, dataset abstractions, pipeline infrastructure, and pluggable linear algebra backend for the ferrolearn machine learning framework.
Every other ferrolearn crate depends on this one.
Key types
ML traits
Fit<X, Y>— train a model, producing a fitted typePredict<X>— generate predictions from a fitted modelTransform<X>— transform data (scalers, PCA, etc.)PartialFit<X, Y>— incremental / online learningFitTransform<X>— fit and transform in one step
Compile-time safety
Unfitted models implement Fit but not Predict. Calling fit() returns a new fitted type that implements Predict. Attempting to call predict() on an unfitted model is a compile error.
use ;
// model.predict(&x); // compile error — Ridge does not implement Predict
let fitted = model.fit?;
let y_hat = fitted.predict?; // OK — FittedRidge implements Predict
Error handling
All public functions return Result<T, FerroError>. Library code never panics.
Pipeline
Pipeline composes transformers and a final estimator using dynamic dispatch:
use Pipeline;
let pipeline = new
.add_transformer
.add_estimator;
Backend trait
The Backend trait abstracts linear algebra operations (SVD, QR, Cholesky, eigendecomposition). The default NdarrayFaerBackend delegates to the faer crate.
Introspection
HasCoefficients— access fitted model coefficientsHasFeatureImportances— access feature importance scoresHasClasses— access class labels from classifiers
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.