Skip to main content

Data drift checking for ML projects

Project description

pydrifter

An open-source framework to test and monitor ML models and systems.

PyPi Downloads License PyPi Python version

pydrifter is a lightweight, extensible Python library for detecting data drift between control and treatment datasets using statistical tests.
It is designed for Data Scientists, ML Engineers, and Analysts working with production models and experiments (A/B tests, model monitoring, etc).


🚀 What is pydrifter?

pydrifter provides a unified interface for applying and analyzing statistical tests (e.g., KS-test, Wasserstein distance, PSI, Jensen-Shannon divergence) across multiple features in tabular datasets.

It is useful for:

  • A/B testing: Detect whether experiment groups differ significantly.
  • Model monitoring: Identify drift in features over time.
  • Data quality checks: Validate dataset consistency before training or inference.

🛠️ Features

  • 🧪 Plug-and-play statistical test classes with unified API
  • 📈 Visualizations for ECDF, KS-test distances, and histograms
  • 🧹 Preprocessing config with quantile filtering
  • 🧩 Easily extendable with your own test logic
  • ✅ Built-in logging, warnings, and tabulated results

📦 Installation

pip install pydrifter

👨‍💻 Example Usage

import pandas as pd
from pydrifter.config import TableConfig
from pydrifter.calculations import KLDivergence, PSI, Wasserstein
from pydrifter import TableDrifter

data_control = pd.DataFrame({
    'age': [25, 30, 35, 40, 45],
    'salary': [50000, 60000, 70000, 80000, 90000],
})

data_treatment = pd.DataFrame({
    'age': [26, 31, 36, 41, 46],
    'salary': [51000, 61000, 71000, 81000, 91000],
})

data_config = TableConfig(numerical=['age', 'salary'], categorical=[])

drifter = TableDrifter(
    data_control=data_control,
    data_treatment=data_treatment,
    data_config=data_config,
    tests=[KLDivergence, PSI, Wasserstein]

)

result, summary = drifter.run_statistics(show_result=True)

drifter.draw("age", quantiles=[0.05, 0.95])

👥 Who is it for?

  • Data Scientists running experiments or training models
  • ML Engineers monitoring pipelines in production
  • Analysts working with control/treatment comparisons

📚 Documentation

Soon


📄 License

APACHE License © 2025 Made with ❤️ by Eugene C.

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

pydrifter-0.1.6.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

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

pydrifter-0.1.6-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file pydrifter-0.1.6.tar.gz.

File metadata

  • Download URL: pydrifter-0.1.6.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.12 Darwin/24.0.0

File hashes

Hashes for pydrifter-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ba0b4e111a1c284f3b30e417b2f42f64a7bf7bc37e1b82ff188900ba9adb51c6
MD5 5343fa052403fe99644be34a518f306d
BLAKE2b-256 a3ab506392f9e07841c94c479f8dfebd095fc4531fb00202ea8fdcdd1685898c

See more details on using hashes here.

File details

Details for the file pydrifter-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pydrifter-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.12 Darwin/24.0.0

File hashes

Hashes for pydrifter-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1c418e59a949ddb267b9e516b8e0a18ebe2a059b4f1605ded171c3c37c98deda
MD5 5384268a8c7ff04270ea91658f818011
BLAKE2b-256 8c4ab1a6d54469558b63f84479f915d954619efa89863cdb6aac34b5c986fd9d

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