Drift Detection for PyTorch
Project description
TorchDrift: drift detection for PyTorch
TorchDrift is a data and concept drift library for PyTorch. It lets you monitor your PyTorch models to see if they operate within spec.
We focus on practical application and strive to seamlessly integrate with PyTorch.
Installation
To install the latest release version use
pip install torchdrift
To get the latest and greatest install from git with
pip install git+https://github.com/torchdrift/torchdrift/
Documentation
Our documentation is at TorchDrift.org.
Examples
Check out our worked example with an ImageNet-type classifier.
If you have a model (without head) as the feature extractor and a training dataloader you can fit the reference distribution as
drift_detector = torchdrift.detectors.KernelMMDDriftDetector()
torchdrift.utils.fit(train_dataloader, feature_extractor, drift_detector)
and then check drifts with
features = feature_extractor(inputs)
score = drift_detector(features)
p_val = drift_detector.compute_p_value(features)
if p_val < 0.01:
raise RuntimeError("Drifted Inputs")
Also check out our deployment example for integration of TorchDrift into inference with a model.
Authors
TorchDrift is a joint project of Orobix Srl, Bergamo, Italy and MathInf GmbH, Garching b. München, Germany.
The TorchDrift Team: Thomas Viehmann, Luca Antiga, Daniele Cortinovis, Lisa Lozza
Acknowledgements
We were inspired by
- Failing Loudly: An Empirical Study of Methods for Detecting Dataset Shift, NeurIPS 2019 https://github.com/steverab/failing-loudly
- Hendrycks & Dietterich: Benchmarking Neural Network Robustness to Common Corruptions and Perturbations ICLR 2019 https://github.com/hendrycks/robustness/
- Van Looveren et al.: Alibi Detect https://github.com/SeldonIO/alibi-detect/
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 Distributions
Built Distribution
File details
Details for the file torchdrift-0.1.0.post1-py3-none-any.whl
.
File metadata
- Download URL: torchdrift-0.1.0.post1-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.9.1+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a211e9d9572432a12eb57d4c0dc099e8c6309c48718cc4256cc445b338ddb57d |
|
MD5 | 63544f745aea529ac04f9d40f68764ce |
|
BLAKE2b-256 | 07c4ec78a41ad83bcff8b47982f87d7a651fe86aca4c8cff14a2a8eac2465f5a |