Skip to main content

No project description provided

Project description

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

  • Pipeline: DAG-based node graph for defining ML workflows with stages (data transformation) and heads (model prediction)
  • Experimenter: Experiment execution engine with LRU caching, state management, and error resilience
  • Trainer: Cross-validation training pipeline with split management
  • Collectors: Extensible data collection — metrics, stacking outputs, model attributes, SHAP values, raw outputs
  • Adapters: Unified interface for scikit-learn, XGBoost, LightGBM, CatBoost, and Keras
  • Data Flexibility: Support for pandas, polars, cuDF, and NumPy arrays

Architecture Overview

Pipeline          Define node graphs (stages + heads) with groups and edges
    │
Experimenter      Execute pipelines, manage cache and state
    │
  ├── ExpObj      Per-node build/experiment objects (StageObj, HeadObj)
  ├── Trainer     Cross-validation training with split management
  └── Collector   Collect metrics, predictions, model attributes, SHAP values

Node State Model:

init ──→ built ──→ finalized
  │
  └──→ error ──→ (reset) ──→ init

Quick Start

from mllabs import Experimenter, Connector, MetricCollector

exp = Experimenter(data=df, path="exp/my_experiment")

p = exp.pipeline
p.set_grp("scale", role="stage", processor="StandardScaler")
p.set_grp("model", role="head", processor="LogisticRegression",
          parent="scale", edges={"X": [(None, None)], "y": [(None, "target")]})

p.set_node("lr_default", grp="model")
p.set_node("lr_c01", grp="model", params={"C": 0.1})

mc = MetricCollector("accuracy", Connector(), output_var="prediction",
                     metric_func=lambda y, pred: (y == pred).mean())
exp.add_collector(mc)

exp.build(["lr_default", "lr_c01"])
exp.exp(["lr_default", "lr_c01"])

print(mc.get_metrics(["lr_default", "lr_c01"]))

Documentation

Full documentation is available at https://sunkusun9.github.io/ml-labs/

  • Concepts — Architecture, Pipeline, State model, Data flow
  • User Guide — Pipeline & Experimenter, 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ml_labs-0.6.3.tar.gz (100.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ml_labs-0.6.3-py3-none-any.whl (94.6 kB view details)

Uploaded Python 3

File details

Details for the file ml_labs-0.6.3.tar.gz.

File metadata

  • Download URL: ml_labs-0.6.3.tar.gz
  • Upload date:
  • Size: 100.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ml_labs-0.6.3.tar.gz
Algorithm Hash digest
SHA256 a6e7d044b8c4482b2aa009573da7217252a4e954bebb5badae59539a59eda186
MD5 3f90f2937db65bd39aa6960f6a560ed2
BLAKE2b-256 d5cd7d9f3096292b065fe49f217a71ab3977aae22a7eba1245fd18b7617b888a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_labs-0.6.3.tar.gz:

Publisher: publish.yml on sunkusun9/ml-labs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ml_labs-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: ml_labs-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 94.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ml_labs-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41dbca00d4a62a6a74e162e479bf568caf2b8bfcbec2f2b7421c6f5a8275dd69
MD5 0a27b031f2d47036f1a50c02f2d051a6
BLAKE2b-256 f6ff69f5a9f186bd0663bf944e745c9d7d3d2fadeab241113292c3bc4d3d9016

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_labs-0.6.3-py3-none-any.whl:

Publisher: publish.yml on sunkusun9/ml-labs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page