Expand description
§RillML
Lightweight, serializable online machine learning for Rust applications and streaming data.
RillML provides incremental learning primitives that can be embedded directly in native Rust applications: online statistics, preprocessors, linear/logistic regression, evaluation metrics, pipelines, progressive evaluation, drift detection, online decision-making (bandits), and optional serde-based state persistence.
§Quick start
use rill_ml::{
metrics::Mae,
models::{LinearRegression, LinearRegressionConfig},
optim::{Optimizer, SgdConfig},
pipeline::RegressionPipeline,
preprocessing::StandardScaler,
Metric, OnlineRegressor,
};
let feature_count = 2;
let scaler = StandardScaler::new(feature_count).unwrap();
let optimizer = Optimizer::sgd(
feature_count,
SgdConfig { learning_rate: 0.05, l2: 0.0 },
).unwrap();
let regression = LinearRegression::new(
feature_count,
LinearRegressionConfig { optimizer, loss: Default::default() },
).unwrap();
let mut model = RegressionPipeline::new(scaler, regression).unwrap();
let mut mae = Mae::default();
let samples = [
([0.1, 0.2], 0.5),
([0.3, 0.8], 1.4),
([0.6, 0.4], 1.1),
];
for (features, target) in samples {
let prediction = model.predict(&features).unwrap();
mae.update(target, prediction).unwrap();
model.learn(&features, target).unwrap();
}Re-exports§
pub use error::RillError;pub use evaluate::BinaryClassificationSample;pub use evaluate::RegressionSample;pub use traits::Metric;pub use traits::OnlineBinaryClassifier;pub use traits::OnlineRegressor;pub use traits::OnlineStatistic;pub use traits::SparseClassifier;pub use traits::SparseRegressor;pub use traits::Transformer;
Modules§
- bandit
bandit - Online decision-making: multi-armed bandits and contextual bandits.
- diagnostics
- Diagnostics for online models.
- drift
- Drift detection and adaptation.
- error
- Error types for RillML.
- evaluate
- Progressive (prequential) evaluation.
- feature_
hasher - Feature hashing for dimensionality reduction.
- loss
- Loss functions for online models.
- metrics
- Online evaluation metrics.
- models
- Online models: baseline regressors, linear regression, logistic regression, Naive Bayes classifiers, and FTRL-Proximal for sparse features.
- optim
- Optimizers for online linear models.
- persistence
- Model state persistence via a versioned
Snapshotenvelope. - pipeline
- Static two-segment pipelines: transformer + model.
- preprocessing
- Feature preprocessing transformers.
- sparse
- Sparse feature representation for high-dimensional data.
- stats
- Online univariate statistics with bounded memory.
- traits
- Core traits shared across RillML.