Skip to main content

Drift monitoring client in Python.

Project description

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!

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

drift_monitor-0.0.4.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

drift_monitor-0.0.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file drift_monitor-0.0.4.tar.gz.

File metadata

  • Download URL: drift_monitor-0.0.4.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for drift_monitor-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d1c0c782d3cf87a5226fb00ccd4485ab89097713dcbeaa6960b61e7342f80611
MD5 f1a9c8534a422ebf4e808a830b51aa8f
BLAKE2b-256 683031fe69cce504682c94ace40b83d3a2ce26416b3ff7e469c83cd27e9a2199

See more details on using hashes here.

File details

Details for the file drift_monitor-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: drift_monitor-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for drift_monitor-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2f396cef0f3ebc1c3bcfd46a1f44d6033bfd726bb1009dca5b414775d9cf4964
MD5 3170006effd87ea60dee2fc4f4075544
BLAKE2b-256 80fe85c0bf00d4c66acbea956a4102b32ed824a2677e6d2e51ed1ddab1e1877e

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