Skip to main content

ML readiness auditor for tabular data with safe normalization and reproducible cleaning recipes

Project description

mlready

mlready is a lightweight Python library for making tabular datasets safe and ready for machine-learning pipelines.

It focuses on observation → risk detection → safe normalization, not aggressive automation.


Why mlready?

Real-world datasets fail ML pipelines because of:

  • numeric values stored as strings ("$1,200", "1.2M")
  • inconsistent booleans (Yes / no / YES / n)
  • datetime columns stored as text
  • unseen categories between train and test
  • silent data leakage and ID-like columns

mlready helps you detect these issues early and fix only what is safe.


Installation

Base install (data readiness utilities):

pip install mlready

Model reporting (metrics, curves, no plots):

pip install "mlready[report]"

Model reporting with visualizations:

pip install "mlready[report,viz]"
# or
pip install "mlready[full]"

Core API (4 functions)

1️⃣ profile(df)

Purpose: Understand the dataset (read-only).

import mlready as mr

report = mr.profile(df)

What it provides:

  • dataset shape, memory usage, duplicates

  • per-column:

    • dtype and inferred logical type
    • missing counts and percentages
    • unique counts and percentages
    • top values
    • pattern hints (currency, boolean, datetime)

No data is modified.


2️⃣ audit(df, target=None, reference_df=None)

Purpose: Detect ML risks before training.

audit_report = mr.audit(df, target="label")

What it detects:

  • ID-like columns
  • zero-variance columns
  • high-cardinality categoricals
  • numeric / boolean / datetime stored as strings
  • potential target leakage
  • ghost categories (train vs test mismatch)
  • schema drift

Returns structured warnings, not guesses.


3️⃣ apply(df, recipe=None)

Purpose: Safely normalize raw data.

clean_df, recipe, report = mr.apply(df)

What it safely applies (v0.1):

  • currency / numeric string → numeric ("$1,200", "(50)", "1.2M")
  • boolean strings → boolean dtype (Yes / no / YES / n)
  • unambiguous datetime parsing
  • safe numeric downcasting (nullable-aware)

What it does NOT do:

  • no column dropping
  • no encoding
  • no fuzzy category merging
  • no feature engineering

All actions are recorded in a reproducible recipe.

Got it. You want symmetry, not examples, and no model-specific implication.

Below is the correct, precise, non-misleading way to add report() in the same style as your other APIs.

You can paste this directly into your README.


4️⃣ report(model, X_train, X_test, y_train, y_test, ...)

Purpose: Evaluate classification models in a structured, pipeline-safe way.

What it provides:

  • train and test classification reports

  • summary metrics:

    • accuracy
    • balanced accuracy
    • precision / recall / F1 (macro, weighted)
  • confusion matrix (data + optional plot)

  • feature importance (when supported by the model)

  • confidence analysis (probability distributions, when available)

  • error analysis:

    • top misclassified rows with confidence scores
  • model performance curves (optional):

    • ROC and Precision–Recall (binary)
    • calibration curve (probability-based models)
    • macro One-vs-Rest ROC-AUC (multiclass)
    • optional per-class OvR ROC curves (multiclass)

Model support scope:

  • designed for sklearn-compatible classifiers
  • requires predict()
  • uses predict_proba() and/or decision_function() when available
  • supports tree-based, linear, kernel-based, and sklearn-wrapped models

What it does NOT support:

  • regression models
  • clustering / anomaly detection
  • multilabel (multi-hot) classification
  • raw deep-learning models without sklearn-style APIs

Optional dependencies are required for reporting and visualization.


Design Principles

  • Safety first – no silent destructive actions
  • Sampling-aware – fast on large data, reliable on small data
  • Pipeline-friendly – deterministic behavior via recipes
  • Minimal dependencies – pure pandas / numpy

When to use mlready

Use mlready when:

  • ingesting raw CSVs or business data
  • validating train vs test consistency
  • preparing data before encoding / modeling
  • building reproducible ML pipelines

Not intended to replace:

  • feature engineering libraries
  • AutoML tools
  • visualization-heavy EDA tools

Project Status

  • Version: 0.1.0
  • Stable core API
  • Tests included
  • Ready for production pipelines (safe mode)

License

MIT License


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

mlready-0.2.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

mlready-0.2.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file mlready-0.2.0.tar.gz.

File metadata

  • Download URL: mlready-0.2.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mlready-0.2.0.tar.gz
Algorithm Hash digest
SHA256 50b9f0c2fe6bd7e4b19bc7855741a74b60ebf63c92d41f1817ce476e6c49b4ff
MD5 3cc04f2a298e6652f4abfad5d30a67b0
BLAKE2b-256 e6d38d1295eb0690289843bc0de44f52c9cd8c50348191f177b6dc49e0b8f176

See more details on using hashes here.

File details

Details for the file mlready-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mlready-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mlready-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0c16a33506aca222e3ead000f5c521718ce8deabfe33e80f3761231d86bdfaf
MD5 3ef7da6adcf3f02a8f8d5b10aa8e9f8e
BLAKE2b-256 95ae76439a59e7d5ba40764fe81cd263417dafc4eb7b67c60ccff8f0b4a3e212

See more details on using hashes here.

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