This is the official implementation of the paper How To Trust Your Diffusion Model: A Convex Optimization Approach to Conformal Risk Control @ ICML 2023
by Jacopo Teneggi, Matt Tivnan, J Webster Stayman, and Jeremias Sulam.
It is based on
The demo is included in the demo.ipynb
notebook. It showcases how to use the
which reduces the mean interval length compared to RCPS on the same data by
Let cal_x, cal_y
be the calibration set containing
from krcps.utils import get_uq, get_calibration
# Compute the entrywise calibrated intervals of `cal_y` with miscoverage level `alpha = 0.10`.
alpha = 0.10
calibrated_quantile_fn = get_uq("calibrated_quantile", alpha=alpha, dim=1)
cal_I = calibrated_quantile_fn(m_cal_y)
# Conformalize the family of nested set predictors `cal_I` with number of dimensions `k = 2`
krcps_fn = get_calibration("k_rcps")
_lambda_k = krcps_fn(
cal_x, cal_I,
"hoeffding_bentkus",
epsilon=0.10,
delta=0.10,
lambda_max=0.5,
stepsize=2e-03,
k=2,
"01_loss_otsu",
n_opt=128,
prob_size=50
)
krcps/bounds.py
, krcps/uq.py
, and krcps/membership.py
respectively.
All model checkpoints are available on Zenodo alongside the perturbed images used in the paper. checkpoints.zip
and denoising.zip
should both be unzipped in the experiments
folder.
@article{teneggi2023trust,
title={How to Trust Your Diffusion Model: A Convex Optimization Approach to Conformal Risk Control},
author={Teneggi, Jacopo and Tivnan, Matt and Stayman, J Webster and Sulam, Jeremias},
journal={arXiv preprint arXiv:2302.03791},
year={2023}
}