mltreelib¶
Tree-based machine learning with a Rust core. A data & feature layer that treats missing data as first-class, an adjustable benchmark generator with known ground truth, and a tree learner that handles categoricals and missing values natively — with rpart-faithful printing, SVG diagrams, and LightGBM-style monotone & interaction constraints.
- Rust core (
mltreelib-core), thin Python shell (PyO3) - Scikit-learn-shaped API — without the scikit-learn dependency
- NA and NaN handled end-to-end: missing in → missing out; imputation opt-in
- 51 TabArena-v0.1 benchmark datasets on board, plus a generator whose knobs control how much signal lives in group and hierarchy structure
flowchart TD
subgraph RustCore["mltreelib-core (Rust Engine)"]
direction LR
Frame["Typed Frame & NA Policy"] --> SplitSearch["Greedy Split Search\n(SSE, Gini, Chow Gate, Oblique)"]
SplitSearch --> LeafFit["Decoupled Leaf Solvers\n(Ridge OLS, Huber, Quantile, GLM)"]
end
subgraph PythonShell["mltreelib (Python FFI)"]
direction LR
ModelTree["ModelTree API"] & LeafControl["LeafControl"] & Metrics["Metrics & Diagnostic Curves"]
end
PythonShell <==>|"PyO3 Zero-Copy / Fast Memory"| RustCore
classDef rustBox fill:#1e3a5f,stroke:#2b4c7e,stroke-width:2px,color:#ffffff;
classDef pyBox fill:#0f5132,stroke:#198754,stroke-width:2px,color:#ffffff;
classDef frameBox fill:#2c3e50,stroke:#34495e,stroke-width:2px,color:#ffffff;
class Frame,SplitSearch,LeafFit rustBox;
class ModelTree,LeafControl,Metrics pyBox;
uv sync # venv + Rust extension (maturin)
uv run python examples/quickstart.py # fit, print, visualize (34.3% RMSE reduction on Concrete)
uv run python examples/real_tree_studies.py wine # after downloading Wine Quality
| I want to… | go to |
|---|---|
| install it | Installation |
| see it work in 30 seconds | Quickstart |
| choose a modeling task | Practical modeling pathways |
| solve a real problem | Real datasets and worked studies |
| change one part of a model | Example library |
| wrangle data & encodings | Examples — Data Processing |
| know every knob | Examples — Model building & predictions |
| read the numbers | Examples — Inspection |
| draw the tree | Visualization |
| see how it compares | Benchmarks — ELO |
| read technical deep dives & blogs | Blog & Technical Insights |
| look up every parameter | API reference |
Featured Technical Articles¶
Explore our in-depth architectural and commercial case studies:
- Decision Trees for Credit Scoring Regulatory Compliance & Fintech: How tree paths, constraints and calibration support model review.
- Zero-Imputation Predictive Maintenance for Industrial Sensor Feeds Industrie 4.0 & Sensor Telemetry: A synthetic example of missing sensor values and tree routing.
- Uplift Modeling with Causal Trees Commercial Decision Optimization: How an honest causal tree compares targeting policies on a randomized held-out trial.
- Cubist Models and C5.0 Rules Core Systems ML: Linear leaves, extracted rules and the contracts still to check.
- Beyond Mean Squared Error: Distributional Decision Trees for Heavy Tails, Insurance, and Censored Data Actuarial & Risk Modeling: Tweedie compound Poisson-Gamma claims, Tobit censored log-likelihood, and heteroscedastic volatility regimes.
- Breaking the Step Function: Model Trees and Step Functions for Continuous Regression Systems ML & Physics-Informed ML: How linear leaves represent local trends and why fair comparisons need held-out data.
- Segregate First, Model Later: Two-Stage Hierarchical Survival Trees for Longitudinal Cohorts Actuarial & Retention Analytics: How decoupling ID-level cohort discovery from leaf-level Kaplan-Meier curves eliminates right-censoring bias and non-proportional hazard violations.
Try it right now
uv run python examples/quickstart.py fits a tree, prints it in rpart
format and writes an SVG diagram. The end-to-end walkthrough then does the same on
10,000 real bank customers.
The research program, roadmap and contribution rules live in the repository
(README.md, AGENTS.md).