ml-labs
A structured machine learning experimentation framework for building, managing, and evaluating ML pipelines with cross-validation, caching, and multi-framework support.
Installation
pip install ml-labs
With optional dependencies:
pip install ml-labs[xgboost] # XGBoost support
pip install ml-labs[lightgbm] # LightGBM support
pip install ml-labs[catboost] # CatBoost support
pip install ml-labs[shap] # SHAP value analysis
pip install ml-labs[polars] # Polars DataFrame support
pip install ml-labs[tensorflow] # Neural network estimators (NNClassifier, NNRegressor)
pip install ml-labs[all] # All optional dependencies
Key Features
- Project: Owns the directory layout and what is project-wide — pipelines, the Trial store, the shared cache
- PipelineBuilder → Pipeline: A mutable builder producing an immutable node graph; definitions are declarations, resolved only at execution time
- Experimenter: Evaluates Trials — candidate models — with nested cross-validation, caching and error resilience
- Trainer: Trains Predictors — the candidates you chose — and exports a standalone
Inferencer - Collectors: Extensible collection — metrics, stacking outputs, model attributes, SHAP values, raw outputs — with a per-fold history of what each one did
- Adapters: Unified interface for scikit-learn, XGBoost, LightGBM, CatBoost and Keras
- Data Flexibility: pandas, polars, cuDF and NumPy arrays
Architecture Overview
Project ─────────── directory layout + pipelines, TrialStore, cache
│
├─ PipelineBuilder ──build()──► Pipeline preprocessing nodes only
│
├─ Experimenter ─── evaluates Trials, fold by fold exp/{name}/
│
└─ Trainer ──────── trains Predictors on full data trainers/{name}/
│
└─ to_inferencer() ──► Inferencer standalone at serve time
Each run keeps its splitter, its adopted Pipeline and its artifacts in its own
directory, and reopens from that path alone — no Project required.
Node State Model:
init ──→ built
▲
└──→ error ──→ (reset_nodes) ──→ init
Quick Start
from mllabs import Project, Trial, Connector
project = Project('exp')
p = project.pipeline_builder('main')
p.set_datasource({'age': 'numerical', 'income': 'numerical', 'target': 'binary'},
targets=['target'])
p.set_node('scale', processor='sklearn.preprocessing.StandardScaler',
method='fit_transform', edges={'X': '{age, income}'})
e = project.experimenter('cv', df, pipeline_name='main',
pipeline_version=project.build_pipeline(p).version)
e.build()
collectors = e.collectors
collectors.set_collector(
'acc', 'mllabs.collector.MetricCollector',
{'__ref__': 'mllabs.Connector', '__params__': {'edges': {'y': '{target}'}}},
params={'output_var': '-1:',
'metric_func': {'__callable__': 'sklearn.metrics.accuracy_score'}})
trials = [Trial(f'lr_{c}', 'sklearn.linear_model.LogisticRegression',
{'X': 'scale:(*)', 'y': '{target}'}, method='predict',
params={'C': c})
for c in (0.1, 1.0)]
names = project.set_trials(trials)
e.exp(names)
print(collectors.get_collector('acc').get_metrics_agg(None)[0])
Documentation
Full documentation is available at https://sunkusun9.github.io/ml-labs/
- Concepts — Architecture, Pipeline, State model, Data flow
- User Guide — Project & Pipeline, edges DSL, Experimenter & Trials, Trainer & Collectors, Adapters, Processors, Neural Networks
- Serving Guide — Inferencer export and inference
- API Reference — Full API reference
Requirements
- Python >= 3.10
- pandas >= 1.5
- numpy >= 1.23
- scikit-learn >= 1.2
- cachetools >= 5.0
License
PolyForm Noncommercial 1.0.0 — free for non-commercial use.
Metadata
Release files for ml-labs 0.10.0
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 |
|---|---|---|---|---|
| ml_labs-0.10.0.tar.gz | 248.7 kB | With provenance | Details for ml_labs-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ml_labs-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for ml_labs-0.10.0-py3-none-any.whl |
Total release size: 444.3 kB
Release files / ml_labs-0.10.0.tar.gz
| Download URL | ml_labs-0.10.0.tar.gz |
|---|---|
| Size | 248.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f8f71aeec25427b482b17fe3bce0af30eb80dfb7cd7245b7bf13c208eb73398
|
|
BLAKE2b-256 checksum How to use checksums |
f2a49f08cb4db799baebd5beef6036e4298fa4e0e8a3a361b06626688d73c030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logRelease files / ml_labs-0.10.0-py3-none-any.whl
| Download URL | ml_labs-0.10.0-py3-none-any.whl |
|---|---|
| Size | 195.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d18f7d33327a50f47858c4fdaa4a568f8d3ddace68549b879a98f648702453eb
|
|
BLAKE2b-256 checksum How to use checksums |
4a4d7b234cb06f5b5aef59e5c93ce4e8ea06f2fcd57a4c2369e52b2d14a23359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logSecurity for ml-labs 0.10.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ml_labs-0.10.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logA 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.