mlw 
A grammar of machine learning workflows for Python. Four verbs prevent data leakage by construction. 16 algorithms, 11 Rust-native.
Paper · R · Rust engine · epagogy.ai
Install
pip install mlw # core (11 Rust-native algorithms)
pip install "mlw[xgboost]" # + XGBoost
pip install "mlw[all]" # everything
Python 3.10+. Also available: lightgbm, catboost, plots, optuna, dev.
Quickstart
import ml
data = ml.dataset("churn")
s = ml.split(data, "churn", seed=42)
lb = ml.screen(s, "churn", seed=42) # rank all algorithms
model = ml.fit(s.train, "churn", seed=42)
ml.evaluate(model, s.valid) # iterate freely
final = ml.fit(s.dev, "churn", seed=42) # retrain on train+valid
ml.assess(final, test=s.test) # once — second call errors
Why ml
The evaluate/assess boundary. evaluate runs on validation data —
call it as often as you like. assess runs on held-out test data and
locks after one use. No discipline required; the API makes leakage
inexpressible. This encodes the protocol from Hastie, Tibshirani &
Friedman (ESL, Ch. 7).
Three-way split with .dev. Train (60%), valid (20%), test (20%).
s.dev = train + valid combined for the final refit before assessment.
47 verbs, one import. From check_data and split through tune,
stack, explain, drift, and shelf. Everything returns plain
objects you can inspect, compare, or serialize.
168 datasets. tips and flights are bundled. The rest download
from OpenML on first use and cache locally.
Highlights
Tune. Random, Bayesian (mlw[optuna]), or grid search.
tuned = ml.tune(s.train, "churn", algorithm="xgboost", seed=42, n_trials=50)
ml.evaluate(tuned, s.valid)
Ship gate. Hard pass/fail contracts before deployment.
ml.validate(final, test=s.test, rules={"accuracy": ">0.85"})
Drift. Catch distribution shift before users notice.
ml.drift(reference=s.train, new=live_data).shifted
Algorithms
16 families. engine="auto" picks Rust when available. engine="sklearn"
forces scikit-learn fallback.
| Algorithm | String | Engine | Clf | Reg |
|---|---|---|---|---|
| Random Forest | "random_forest" |
Rust | Y | Y |
| Extra Trees | "extra_trees" |
Rust | Y | Y |
| Gradient Boosting | "gradient_boosting" |
Rust | Y | Y |
| Hist. Gradient Boosting | "histgradient" |
Rust | Y | Y |
| Decision Tree | "decision_tree" |
Rust | Y | Y |
| Ridge | "linear" |
Rust | · | Y |
| Logistic | "logistic" |
Rust | Y | · |
| Elastic Net | "elastic_net" |
Rust | · | Y |
| KNN | "knn" |
Rust | Y | Y |
| Naive Bayes | "naive_bayes" |
Rust | Y | · |
| AdaBoost | "adaboost" |
Rust | Y | · |
| SVM | "svm" |
Rust | Y | Y |
| XGBoost | "xgboost" |
optional | Y | Y |
| LightGBM | "lightgbm" |
optional | Y | Y |
| CatBoost | "catboost" |
optional | Y | Y |
| TabPFN | "tabpfn" |
optional | Y | · |
Citation
Roth, S. (2026). A Grammar of Machine Learning Workflows.
doi:10.5281/zenodo.19023838
License
MIT. Simon Roth, 2026.
Metadata
Release files for mlw 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mlw-1.1.2.tar.gz | 1.1 MB | Without provenance | Details for mlw-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mlw-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for mlw-1.1.2-py3-none-any.whl |
Total release size: 2.1 MB
Release files / mlw-1.1.2.tar.gz
| Download URL | mlw-1.1.2.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e167aeb03a46802999c7c996e24c71e7c3aa00d0acf7d8104788c6efd1fe0d70
|
|
BLAKE2b-256 checksum How to use checksums |
822baee726f4a60203fb00854132d1691173f8a0fef0af96e670a6cdd70b06d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / mlw-1.1.2-py3-none-any.whl
| Download URL | mlw-1.1.2-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
372dda99540c9c4d40245bdc585867d8ff57c4af59e63512db2b5e23814ae824
|
|
BLAKE2b-256 checksum How to use checksums |
2b37441397aa0cc2690993fd06ceaba97213d3e7b240aadf3c8b9d39e5f6e2f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for mlw 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.