This repository contains the code for reproducing the experiments and figures presented in the paper Backward Conformal Prediction.
The repository is structured into three main folders, each corresponding to one of the three experiments presented in the paper: binary classification (Breast Cancer Wisconsin), image classification with constant size constraint rule (CIFAR-10-constant), and image classification with adaptive size constraint rule (CIFAR-10-adaptive). Each folder is self-contained and independent of the others.
-
Run the
binary-classification.ipynbnotebook. This notebook loads and preprocesses the data, trains an XGBoost classifier, applies backward conformal prediction, and compares the results with the standard conformal prediction method. -
The resulting plot from the backward conformal prediction process is saved in the
plots/directory.
-
(Optional) Run the
model_train.ipynbnotebook to re-train the model f. This will download and store the CIFAR-10 dataset in thedata/subfolder. -
Execute the
constant-size-constraint-rule.ipynbnotebook to reproduce the experiments from the paper. The notebook will load the CIFAR-10 dataset from thedata/subfolder (downloading it if necessary). You can manually adjust the calibration size and the constant size constraint rule. -
The resulting adaptive miscoverage values and leave-one-out estimators are saved in the
alphas/subfolder, and the generated plots are stored in theplots/subfolder.
-
(Optional) Run the
model_train.ipynbnotebook to re-train the model f. This will download and store the CIFAR-10 dataset in thedata/subfolder. -
Execute the
adaptive-size-constraint-rule.ipynbnotebook to reproduce the experiments from the paper. The notebook will load the CIFAR-10 dataset from thedata/subfolder (downloading it if necessary). You can manually adjust the calibration size. The size constraint rule is defined adaptively, following the approach described in the paper. An additional notebookillustration-rule.ipynbis provided to illustrate how the size constraint rule works in practice. -
The resulting adaptive miscoverage values and leave-one-out estimators are saved in the
alphas/subfolder, and the generated plots are stored in theplots/subfolder.