Skip to main content

Drift Monitoring Detector

Description

Drift Monitoring Detector is a Python client for monitoring concept and data drift in machine learning models. It provides an easy-to-use interface to interact with a drift monitoring server, allowing users to create experiments, log drift detections, and manage drift runs.

Features

  • Create and manage experiments
  • Log concept and data drift detections
  • Automatically handle drift run statuses
  • Integration with external monitoring servers

Badges

GitHub Workflow Status Coverage

Visuals

Drift Monitoring Detector

Installation

To install the library (client), run:

pip install drift-monitor

Usage

Setting Up Environment Variables

Set the following environment variables to connect to your drift monitoring server:

  • DRIFT_MONITOR_URL: Url pointing to the monitor server, e.g. https://drift-watch.dev.ai4eosc.eu
  • DRIFT_MONITOR_MYTOKEN: Token to authenticate with the monitor server from mytoken.data.kit.edu

If you do not know how to set environment variables before starting your Python script, you can set them in your script as follows:

import os
os.environ["DRIFT_MONITOR_URL"] = "https://drift-watch.dev.ai4eosc.eu"
os.environ["DRIFT_MONITOR_MYTOKEN"] = "token_from_mytoken.data.kit.edu"
import drift_monitor

Note this is not PEP8 compliant, but it is a quick way to set environment variables in your script.

Example Usage

from drift_monitor import DriftMonitor, new_experiment, register

# Register the user
register(accept_terms=True)

# Create a new experiment
experiment_name = f"My Experiment Example"
description = "Test experiment example"
new_experiment(experiment_name, description, public=True)

# Define your detector methods
def concept_detector(*args, **kwds) -> tuple[bool, dict]:
    return True, {"feature1": 0.05, "feature2": 0.1}

def data_detector(*args, **kwds) -> tuple[bool, dict]:
    return True, {"feature3": 0.02, {"feature4": 0.08}

# Use DriftMonitor context
with DriftMonitor(experiment_name, "model_1") as monitor:
    detected, detection_parameters = concept_detector()
    monitor.concept(detected, detection_parameters)
    detected, detection_parameters = data_detector()
    monitor.data(detected, detection_parameters)

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project Status

This project is actively maintained. Contributions are welcome!

Metadata

Release files for drift-monitor 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drift-monitor 1.1.1
File Size Uploaded
drift_monitor-1.1.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drift-monitor 1.1.1
File Interpreter ABI Platform
drift_monitor-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.1 kB

Release files / drift_monitor-1.1.1.tar.gz

Download URL drift_monitor-1.1.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
315f4c92c847f218e67f97f64233174c3177d0e353d199843193d5d1e630ecbb
BLAKE2b-256 checksum
How to use checksums
b1b20bdecd8f3a7de1b17400d86bc49a1181790e06a9d917c5b196e7274cec5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / drift_monitor-1.1.1-py3-none-any.whl

Download URL drift_monitor-1.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a4773a91687adfe7a4f31f1de99cba57071ddcbbd8eb9762580fc7e8102dec3
BLAKE2b-256 checksum
How to use checksums
e3875ae225a00fedcf6eed49bca667dac07b49e6bc17bcc978f86bc97a9225c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page