Skip to main content

Lightweight drift and anomaly monitoring for production ML models.

Project description

canary-ml

Lightweight drift and anomaly monitoring for production ML models.

Install

pip install canary-ml

Quickstart

from canary_ml import ModelMonitor

monitor = ModelMonitor(
    model=your_model,
    reference_data=X_train,
    alert_threshold=0.2,
    log_path="./canary_logs"
)

# drop-in replacement — monitoring is a side effect
predictions = monitor.predict(X_new)

report = monitor.get_report()
print(report.summary())
# DriftReport | psi=0.41 | features_drifted=3 | anomaly_rate=3.2% | ALERT

monitor.serve_dashboard(port=8501)

Features

  • Data Drift Detection — KS test, PSI, chi-square per feature with configurable thresholds
  • Anomaly Detection — Isolation Forest and z-score ensemble on inputs and outputs
  • Zero Latency — monitoring is a side effect; inference path stays unchanged
  • Live Dashboard — zero-dep HTML/JS, ships with the package, no cloud account needed

Why

Most ML monitoring tools require a database, a cloud account, or a separate deployment pipeline. canary-ml wraps your model with a single line of code and starts logging drift metrics immediately — to a local JSON-lines file, with no external dependencies.

The dashboard (monitor.serve_dashboard()) reads from that file and auto-refreshes every 5 seconds. You can run it on a laptop, in a Docker container, or on any machine with the package installed.

Roadmap

v1.1

  • Label-free performance estimation: estimate model accuracy/F1 from confidence score distributions without ground truth labels, using confidence-based performance estimation (CBPE). Alerts when estimated performance degrades, not just when inputs shift.

License

MIT

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

canary_ml-1.0.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

canary_ml-1.0.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file canary_ml-1.0.0.tar.gz.

File metadata

  • Download URL: canary_ml-1.0.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for canary_ml-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8cfeab728e4c0dd97a70772d4ad7079445c5a784e4a1c67a019ae53cd86d0565
MD5 6a22b4c57c1be63e0059dda9c97bfae0
BLAKE2b-256 9af59cc355e644278b1600479c8128b32c4a649516995792d125d5067372f132

See more details on using hashes here.

File details

Details for the file canary_ml-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: canary_ml-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for canary_ml-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb2f63fd7a4e49a660897dd2f7c83333bb47d0c1a562d5eb1302a753bf49633
MD5 0f452936d508a0528e832aa7b1bbdfdd
BLAKE2b-256 d167674e1a69df4647130dfc14eb1c33ae319c95957bde2e0d39e6d8ccda8955

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