Expand description
§Millwright
A unified ML framework for Rust — ten crates, one lifecycle.
Millwright assembles proven Rust crates into one composable ML lifecycle — ingest and profile data, build and tune pipelines, evaluate and explain models, export to ONNX, and serve with drift monitoring — behind one data model, one trait contract, and feature-gated backends.
Frame/Dataset— the numeric boundary type the public API speaks.Table(featureeda) is the typed, polars-backed front that lowers into it.- the core contract — object-safe
Transformer,Estimator,Predictor, andProbaPredictor— plus specializedClusterer,Forecaster,PartialFit, andBalancerfor the shapes that need them. Pipelinecomposition with"step__param"addressing, over feature-gated backends (smartcore, linfa, …).
Everything is object-safe, so a pipeline holds a heterogeneous chain of
boxed steps and a boxed model. Each capability is a cargo feature; default
is a lean core and full lights up the whole lifecycle. See the
guide for a tour.
use millwright::prelude::*;
let x = Frame::from_rows(
vec![vec![0.0, 0.0], vec![9.0, 9.0]],
vec!["a".into(), "b".into()],
)?;
let train = Dataset::new(x.clone(), vec![0.0, 1.0])?;
let mut pipe = Pipeline::new()
.step("scale", StandardScaler::new())
.estimator("lr", LogisticRegression::new()); // a core, probability-capable model
pipe.fit(&train)?;
let preds = pipe.predict(&x)?;Re-exports§
Modules§
- anomaly
- Unsupervised outlier detection.
- automl
- AutoML — the framework, pointed at itself.
- backends
- Backend adapters — proven engines behind the four traits.
- balance
- Train-time balancers — the resampling stage of a pipeline.
- calibration
- Probability calibration — turn raw classifier scores into calibrated probabilities, and measure how well-calibrated they already are.
- diagnostics
- Regression diagnostics — OLS residual tests, influence, and
summary(). - ensemble
- Ensembles — combine models, even across backends.
- error
- The single error type for the framework spine.
- evaluate
- Evaluation reports — the metrics half of “trust the model, not just run it”.
- explain
- Explainability — SHAP values and permutation importance.
- frame
- The
Framedata model — the boundary type the whole public API speaks. - logistic
- A native binary logistic-regression classifier — the framework’s first model that produces real class probabilities.
- monitor
- Drift monitoring — PSI on the prediction stream.
- onnx
- ONNX export and inference — train once; run in Rust, Python, or any ONNX runtime.
- pipeline
Pipeline— the composition that ties the contract together.- prelude
- The one import that brings the whole framework into scope.
- profile
Profile— automated EDA over aTable, the Rust answer to ydata-profiling, with a twist only a framework that owns the whole lifecycle can pull off: it returns a typed analysis (not just an HTML blob), and hands back a suggested preprocessing pipeline to start from.- registry
- A versioned model registry — the loop scikit-learn leaves as homework.
- selection
- Model selection — cross-validation, scoring, and search over a pipeline.
- serve
- HTTP inference serving — a
/predictendpoint over the tract runtime. - table
Table— the typed, polars-backed front of the lifecycle.- traits
- The trait contract.
- transform
- Core transformers — all dependency-free and always available.
- viz
- Report figures — ROC and residual charts rendered to SVG.