Bayesian D-PDDM
Bayesian implementation of the D-PDDM algorithm for post-deployment deterioration monitoring. Bayesian D-PDDM is a Bayesian approximation to the D-PDDM algorithm which provably monitors model deterioration at deployment time. Bayesian D-PDDM:
- Flags deteriorating shifts in the unsupervised deployment data distribution
- Resists flagging non-deteriorating shifts, unlike classical OOD detection leveraging distances and/or metrics between data distributions.
Installation and Requirements
This implementation requires python>=3.11.
The easiest way to install bayesian_dpddm is with pip:
pip install bayesian_dpddm
You can also install by cloning the GitHub repo:
# Clone the repo
git clone https://github.com/teivng/bayesian_dpddm.git
# Navigate into repo directory
cd bayesian_dpddm
# Install the required dependencies
pip install .
Sweeping Instructions
All experiments are running from the root directory of the repo. We use hydra-core as an argparse on steroids, in tandem with wandb for sweeping. For a sweeping configuration experiments/my_sweep.yaml, run:
wandb sweep experiments/my_sweep.yaml
for which wandb responds with:
wandb: Creating sweep from: experiments/my_sweep.yaml
wandb: Creating sweep with ID: <my_sweep_id>
wandb: View sweep at: https://wandb.ai/<my_wandb_team>/<my_project>/sweeps/<my_sweep_id>
Sweeping locally
Run sweep agent with: wandb agent <my_wandb_team>/<my_project>/<my_sweep_id>.
Sweeping with slurm
sbatch files format pre-configured for the Vaughan cluster. Edit the templates at will.
We execute a script to replace the wandb agent ... line in our .slrm files:
./experiments/replace_wandb_agent.sh "wandb agent <my_wandb_team>/<my_project>/<my_sweep_id>"
Finally, spam jobs on the cluster and maximize your allocation per qos:
./experiments/sbatch_all.sh
Edit this script per your allocation.
Usage and Tutorials
In short, training a DPDDMMonitor consists of a three steps.
- Train the base model of the monitor on I.I.D. training data
- With a held-out set of I.I.D. validation data, train the distribution of I.I.D. disagreement rates (Phi) of the monitor
- Deploy the base model and monitor by periodically running
dpddm_teston batches of unsupervised deployment data
When dpddm_test returns True, the monitor recognizes that the base model may severely underperform on the unsupervised deployment data. This is the cue for ML practitioners to inspect the problem further and consider further measures such as adapting and retraining.
For a full tutorial on how to deploy bayesian_dpddm to monitor a downstream task, consider running the guidebook tutorials/classification.ipynb where we train a DPDDMBayesianMonitor to monitor an induced deteriorating shift on the UCI Heart Disease dataset.
Citation
Coming soon.
Metadata
Release files for bayesian-dpddm 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bayesian_dpddm-1.0.6.tar.gz | 15.0 kB | Without provenance | Details for bayesian_dpddm-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bayesian_dpddm-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for bayesian_dpddm-1.0.6-py3-none-any.whl |
Total release size: 34.1 kB
Release files / bayesian_dpddm-1.0.6.tar.gz
| Download URL | bayesian_dpddm-1.0.6.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ade7ed97382ff1ab59789040016cd9d20edc482ca41015810e3882915851ad8
|
|
BLAKE2b-256 checksum How to use checksums |
78a4269e6a9926b646e0183679d846771998fc5f683ff9c39051cc93bf5f4042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / bayesian_dpddm-1.0.6-py3-none-any.whl
| Download URL | bayesian_dpddm-1.0.6-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd5981054872c6ac7aac10d7b0c1cc3ce0eee91060813319e69e2a60f46fe1d6
|
|
BLAKE2b-256 checksum How to use checksums |
f3c91fc468500e8e2bdcf74807858681d3a1b694a0c57ef67b1d8329524439c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for bayesian-dpddm 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.