Skip to main content

Machine learning experiment manager and leakage detection toolkit

Project description

MLGuard

PyPI Python License Status

MLGuard is a lightweight machine learning experiment management and data validation toolkit designed to help data scientists quickly validate datasets, detect potential data leakage, and benchmark multiple machine learning models.

It provides a simple interface to run experiments and compare models with minimal setup.


Why MLGuard?

When working with machine learning pipelines, developers often face problems such as:

  • Undetected data leakage
  • Repeated model experimentation scripts
  • Difficulty comparing models quickly
  • Poor experiment organization

MLGuard helps solve these problems by providing:

  • Automated data leakage detection
  • Automatic problem type detection
  • Built-in experiment manager
  • Simple model comparison tools

Features

Data Leakage Detection

Detects potential target leakage by analyzing correlations between features and the target variable.

Experiment Manager

Runs multiple machine learning models automatically and evaluates their performance.

Model Comparison

Compares model performance using appropriate evaluation metrics.

Automatic Problem Detection

Detects whether the task is:

  • Regression
  • Classification

Installation

Install from PyPI:

pip install mlguardlabs

Install locally for development:

pip install -e .

Quick Example

Regression Example

from sklearn.datasets import fetch_california_housing
from mlguard import ExperimentManager

data = fetch_california_housing(as_frame=True)

X = data.data
y = data.target

exp = ExperimentManager()

exp.fit(X, y)

print(exp.compare())

Example output:

Running leakage detection...
No leakage detected

Detected problem type: regression

[('rf', 0.50), ('ridge', 0.74)]

Classification Example

from sklearn.datasets import load_iris
from mlguard import ExperimentManager

data = load_iris(as_frame=True)

X = data.data
y = data.target

exp = ExperimentManager()

exp.fit(X, y)

print(exp.compare())

Data Leakage Detection Example

from mlguard import LeakageDetector

detector = LeakageDetector()

detector.fit(X, y)

print(detector.report())

This prints features that have unusually high correlation with the target.


How MLGuard Works

MLGuard runs a lightweight validation and experimentation pipeline:

Dataset
   ↓
Leakage Detection
   ↓
Problem Type Detection
   ↓
Model Experiments
   ↓
Model Evaluation
   ↓
Model Comparison

This allows users to quickly answer:

Which model works best for my dataset?


Project Structure

mlguard/
│
├── experiments
│   └── experiment_manager.py
│
├── inspection
│   └── leakage_detector.py
│
├── metrics
│   ├── regression_metrics.py
│   └── classification_metrics.py
│
├── utils
│   └── problem_type.py
│
├── examples
├── tests

Example Workflow

Typical machine learning workflow using MLGuard:

EDA
↓
Feature Engineering
↓
Feature Selection
↓
MLGuard Experiment Manager
↓
Best Model Selection
↓
Hyperparameter Tuning
↓
Final Model

MLGuard helps simplify the experimentation stage.


Roadmap

Future planned features include:

  • Cross-validation experiment engine
  • Dataset inspector
  • Automatic preprocessing pipelines
  • Feature validation tools
  • Experiment tracking

Contributing

Contributions are welcome!

Steps:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

MIT License © 2026 Tarun M

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

mlguardlabs-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

mlguardlabs-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file mlguardlabs-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for mlguardlabs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 344db9de3c6590888a7b22d4571abdb8079c2e147748b7eb6a33b8eeaa68c30f
MD5 8bcef24ccfd8a595579788fc48dca979
BLAKE2b-256 5571653c2c472fc64840097c674d81c760af15794adde792cc337e0628f14763

See more details on using hashes here.

File details

Details for the file mlguardlabs-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mlguardlabs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63babb40eda67640d3d31c522386acdf5ed84cb26fdce7c7b57825e8b01de20b
MD5 d1dc8adacfc3069d216e4f5940d5f486
BLAKE2b-256 e99df3201e2fbcab3f929ff857cf3c93731756be04178e537c0d087475dcd3f1

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