Skip to main content

Lightweight ML drift monitoring, built for real-world pipelines

Project description

DriftWatch

Lightweight ML drift monitoring, built for real-world pipelines

Documentation CI PyPI version Python 3.9+ License: MIT


📖 Documentation

Read the full documentation here: vincentcotella.github.io/DriftWatch

🚀 Features

  • Multi-Drift Monitoring:
    • 📊 Feature Drift: Monitor input data distribution changes (P(X)).
    • 🎯 Prediction Drift: Monitor model output changes (P(Ŷ)).
    • 🧠 Concept Drift: Monitor model performance degradation (P(Y|X)).
  • Unified Interface: DriftSuite combines all monitors in one simple API.
  • 7 Statistical Detectors:
    • PSI, KS-Test, Wasserstein, Jensen-Shannon, Anderson-Darling, Cramér-von Mises, Chi-Squared.
  • Explainability: Built-in statistical explanation (DriftExplainer) and visualization (DriftVisualizer).
  • Production Integrations:
    • FastAPI Middleware
    • 📈 MLflow Tracking
    • 🔔 Slack & Email Alerts
  • Lightweight & Robust: Minimal dependencies, 100% type-safe.

📦 Installation

pip install driftwatch

For specific extras:

pip install driftwatch[viz]     # Visualization support
pip install driftwatch[mlflow]  # MLflow integration
pip install driftwatch[all]     # CLI, API, Alerting, etc.

⚡ Quick Start

DriftWatch v0.4.0 introduces DriftSuite for unified monitoring:

from driftwatch import DriftSuite, DriftType
import pandas as pd

# 1. Initialize suite with reference data (e.g., training set)
suite = DriftSuite(
    reference_data=X_train,
    reference_predictions=y_val_pred,
    task="classification",  # or "regression"
    model_version="v1.0"
)

# 2. Check production batch
report = suite.check(
    production_data=X_prod,
    production_predictions=y_prod_pred
)

# 3. Act on specific drift types
drift_types = report.drift_types_detected()

if DriftType.CONCEPT in drift_types:
    print("🚨 CRITICAL: Concept drift detected — Retrain model!")
elif DriftType.PREDICTION in drift_types:
    print("⚠️ WARNING: Prediction drift — Check model outputs.")
elif DriftType.FEATURE in drift_types:
    print(f"📊 INFO: Feature drift in {report.feature_report.drifted_features()}")
else:
    print("✅ All systems normal.")

🛠️ Usage Scenarios

Scenario Solution
Unified Monitoring Use DriftSuite to track Feature, Prediction, and Concept drift in one go.
Experiment Tracking Log all drift metrics to MLflow for long-term trend analysis.
Real-time API Use DriftMiddleware in FastAPI to monitor every request.
Alerting Send critical alerts via Slack or Email when model performance degrades.
CI/CD Block deployments if DriftType.PREDICTION is detected in staging.

📓 Interactive Tutorials

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repo.
  2. Install dev dependencies: pip install -e ".[dev,all]"
  3. Run tests: pytest
  4. Submit a PR!

📄 License

MIT © Vincent Cotella

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

driftwatch-0.4.0.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

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

driftwatch-0.4.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

Details for the file driftwatch-0.4.0.tar.gz.

File metadata

  • Download URL: driftwatch-0.4.0.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for driftwatch-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ca900fe935c6c8fbad105f67fbe0ab7572c3205d0bb05d0b3d379bc39dc64936
MD5 b3ef2fc095d7623b8379b6e6e3492876
BLAKE2b-256 4dd5715cd935b1e576c2de6f2c4779a05afe9b6e107039776e5dbeabcb5a136b

See more details on using hashes here.

File details

Details for the file driftwatch-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: driftwatch-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for driftwatch-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b13aedec4446e92a1f33f9dd5ae45cbcd47754fc1f2ff26f68f08e4874b1fb81
MD5 43af19d423b9cca11444598499e8dffe
BLAKE2b-256 fad8f6635e34bff73acc3e1d6e5156ec6577e835584c173ca31b11dacd989bb1

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