Streamlit dashboard for monitoring data drift and model metrics.
Project description
ml-drift-detection 📈🔍
Streamlit dashboard for rapid visual monitoring of data drift and model-performance metrics
Why use it?
- One command → full dashboard – point at two files (baseline & new batch) and instantly see
- Feature-level drift (numeric & categorical)
- Label drift & concept drift
- Metric deltas with colour-coded gauges
- Zero vendor lock-in: pure Streamlit + Plotly; runs anywhere Python runs.
- Works as both a command-line tool and an importable library.
Default visual settings
| Setting | Default value |
|---|---|
| Background | "white" (pass --background-color="#0E1117" for dark mode) |
| Gauge colour bands | Relative delta bands for each metric[-1.0 – -0.10] → firebrick[-0.10 – -0.05] → orange[-0.05 – 0.05] → green[ 0.05 – 1.00] → #2ca02c |
You can override the bands per metric with --metric-one-threshold-steps,
--metric-two-threshold-steps, etc. Any argument left empty ([]) falls back to these defaults.
Installation
pip install ml-drift-detection
# optional dev / test extras
pip install -e ".[dev,test]"
Requires Python ≥ 3.9. See pyproject.toml for full dependency list.
Quick-start (CLI)
streamlit run -m ml_drift_detection.cli -- \
--prod-data=prod_df.csv \
--new-data=new_df.csv \
--numeric-cols=age,income,loan_amount \
--categorical-cols=gender,region,plan \
--target-variable=subscription_type \
--target-type=categorical \
--prod-metrics=accuracy=0.91,f1=0.88 \
--new-metrics=accuracy=0.83,f1=0.79 \
--background-color="#0E1117" \
--metric-one-threshold-steps="[{'range':[-1,-0.1],'color':'red'},{'range':[-0.1,0.05],'color':'orange'},{'range':[0.05,1],'color':'green'}]"
Windows PowerShell multi-line example
streamlit run "C:\Python\Lib\site-packages\ml_drift_detection\cli.py" -- `
--prod-data="C:\data\prod_df.csv" `
--new-data="C:\data\new_df.csv" `
--numeric-cols="age,income,loan_amount" `
--categorical-cols="gender,region,plan" `
--target-variable="subscription_type" `
--target-type="categorical" `
--prod-metrics="accuracy=0.91,f1=0.88" `
--new-metrics="accuracy=0.83,f1=0.79"
Programmatic use
from ml_drift_detection import dashboard_main
import pandas as pd
prod_df = pd.read_csv("prod_df.csv")
new_df = pd.read_csv("new_df.csv")
dashboard_main(
prod_df=prod_df,
new_df=new_df,
numeric_cols=["age", "income", "loan_amount"],
categorical_cols=["gender", "region", "plan"],
target_variable="subscription_type",
target_type="categorical",
prod_metrics={"accuracy": 0.91, "f1": 0.88},
new_metrics={"accuracy": 0.83, "f1": 0.79},
)
Public API (mini)
| Symbol | Purpose |
|---|---|
ml_drift_detection.cli_main |
CLI entry-point (invoked by the command above) |
ml_drift_detection.dashboard_main |
Programmatic dashboard launcher |
check_numeric_stats / check_categorical_stats |
Produce pandas summaries of drift metrics |
get_plotly_dist / get_plotly_barplot / get_plotly_boxplot |
Stand-alone Plotly figure builders |
Contributing 🤝
git clone https://github.com/knowusuboaky/ml-drift-detection
cd ml-drift-detection
pip install -e ".[dev,test]"
pre-commit install
pytest
Bug reports & feature requests welcome – open an issue first for large changes.
License
MIT © Kwadwo Daddy Nyame Owusu-Boakye
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ml_drift_detection-0.1.0.tar.gz.
File metadata
- Download URL: ml_drift_detection-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cb6c9790062269532c0293cbf0402f06dd017606dc08b1d1960cdb8ac5a4b0f
|
|
| MD5 |
7a1cca45b4388261c47db30ec979456e
|
|
| BLAKE2b-256 |
ca94a7b302cdcf4732c270249e66744a51cbb1f2b1bf8969a10ad67d16fb49e0
|
File details
Details for the file ml_drift_detection-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ml_drift_detection-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
519e3c99fcd8ca122cab1c08c9d4fbc57263e0a4aa086671b80ca1021747314d
|
|
| MD5 |
9ab1000ed7485e658d876dd7b03fc411
|
|
| BLAKE2b-256 |
b2f72a85eaa9c58ceb0f1d9e64daf0c70a5f2bd5a785e852d756ed4a20ff9ae1
|