Skip to main content

A lightweight machine learning drift monitoring and alerting engine.

Project description

🚦 ModelShift

Label-Free Monitoring for Deployed Machine Learning Models

PyPI version Python 3.8+ License: MIT

A lightweight, behavior-centric system to detect silent reliability degradation in deployed machine learning models — without requiring ground-truth labels.


📌 Why ModelShift?

Machine learning models rarely fail loudly after deployment. Instead, they silently degrade as real-world data changes — while true labels are unavailable for continuous evaluation.

ModelShift addresses this blind spot.


🧩 Problem Statement & Objective

Deployed machine learning models often degrade silently over time due to changing data distributions. Design a label-free, post-deployment monitoring system that tracks:

  • Data distribution shifts
  • Prediction behavior instability
  • Model reliability trends

...to provide early warning signals of degradation without modifying the deployed model.

Note: ModelShift explicitly does not retrain models, correct predictions, or compute accuracy on production data. It focuses solely on deterministic monitoring, telemetry, and interpretability.


🚀 The Architecture (SaaS Infrastructure)

ModelShift is built as a distributed, full-stack monitoring ecosystem:

  1. The PyPI SDK (modelshift): A lightweight Python package installed on the data scientist's local machine or cloud pipeline. It computes complex statistical drift (KS-Statistics, Entropy) locally.
  2. The API Bridge: The SDK authenticates via a secure API_KEY and transmits JSON telemetry payloads across the web.
  3. The Web Hub (FastAPI): A secure cloud server equipped with SQLite, bcrypt cryptographic hashing, and automated routing.
  4. The Cyberpunk Dashboard: A real-time HTML/JS monitoring terminal to visualize pipeline health.
  5. Automated Alerting: Background workers that trigger styled SMTP HTML emails the second a CRITICAL_DRIFT event occurs.

💻 Quickstart

1. Install the SDK

ModelShift is published on the Python Package Index. Install it anywhere:

pip install modelshift
2. Connect Your Pipeline
Add these 5 lines of code to the end of your existing ML inference scripts to instantly beam telemetry to your dashboard:

Python
import pandas as pd
import numpy as np
from modelshift.monitor import ModelMonitor, init

# 1. Authenticate with your Cloud Dashboard API Key
init(api_key="ms_YOUR_API_KEY_HERE")

# 2. Initialize the Engine
monitor = ModelMonitor(reference_df)
monitor.set_baseline_predictions(ref_predictions)

# 3. Feed it live production data
monitor.update(live_df)
monitor.update_predictions(live_predictions)

# 4. Compute statistical drift
monitor.compute_feature_drift()
monitor.compute_prediction_drift()

# 5. Beam telemetry to the cloud
monitor.push()
🛠️ Technology Stack
Data Science & SDK Core:

Language: Python 3.8+

Math & Stats: NumPy, Pandas, SciPy

Networking: Requests

Cloud Backend & Security:

Framework: FastAPI / Uvicorn

Database: SQLite (Relational Storage)

Cryptography: bcrypt (Password Hashing)

Notifications: Python smtplib & email.mime (Background Tasks)

Frontend Dashboard:

UI: HTML5, TailwindCSS, Vanilla JS

Templating: Jinja2

Aesthetic: High-contrast, custom dark-mode / terminal UI

📂 Repository Structure
Plaintext
modelshift-lite/
├── dashboard_web/       # FastAPI Backend & Web Application   ├── data/            # SQLite DB & telemetry storage   ├── static/          # CSS and Vanilla JS for the dashboard   ├── templates/       # HTML Jinja2 templates (login, signup, dash)   ├── app.py           # Core FastAPI router & logic   └── email_alert.py   # Automated SMTP dispatch system
├── modelshift/          # The PyPI SDK Source Code   ├── drift/           # Statistical math (KS, Entropy, severity)   └── monitor.py       # Main ModelMonitor class and API Bridge
├── setup.py             # PyPI package configuration
└── README.md
⚙️ Running the Local Server (For Developers)
To run the full-stack dashboard and backend API on your local machine:

Clone this repository.

Install the backend requirements: pip install fastapi uvicorn bcrypt sqlalchemy jinja2

Start the server:

Bash
uvicorn dashboard_web.app:app --reload
Navigate to http://127.0.0.1:8000 in your browser.

Create an account, generate an API Key, and start tracking your models!

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

modelshift-0.2.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

modelshift-0.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for modelshift-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0028e8fe3dc896b64a7da662349740320d9a936dd7a48259f4514b5eeb665b3
MD5 93d6e2a4d58b95b3d5aacf0d3a71a316
BLAKE2b-256 542ce78c6c047a8099e3cc97cfbdbf9af937943f677cb86be2356c70dd39872e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for modelshift-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a635025f6b41505fd7037730a1c9445c9c0ef72f3acb7a7ffdf136616c1d5a4f
MD5 c9d7399f09d624944f558e4dd8efd2ae
BLAKE2b-256 c7a94d2c72b937ccce13c029523dd0ef09464aca84d8dd9ad3f69588e338fda7

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