Wasserstein-regularized Conformal Prediction

June 4, 2025 · View on GitHub

This is the source code for the paper Wasserstein-Regularized Conformal Prediction under General Distribution Shift. screenshot (a) Joint distribution shift can include both covariate shift (PXQXP_X\neq Q_X) and concept shift (fPfQf_P\neq f_Q). Coverage gap is the absolute difference in cumulative probabilities of calibration and test conformal scores at the empirical $1-\alphaquantilequantile\tau$. We first address covariate-shift-induced Wasserstein distance by applying importance weighting to calibration samples, and further minimize concept-shift-induced Wasserstein distance for accurate and efficient prediction sets;

(b) QV(1)Q_V^{(1)} and QV(2)Q_V^{(2)} are two distinct test conformal score distributions. Wasserstein distance integrates the vertical gap between two cumulative probability distributions overall all quantiles, and is sensitive to coverage gap changes at any quantile. Total variation distance fails to indicate coverage gap changes thoroughly, as it is agnostic about where two distributions diverge.

Data

The data folder contains the datasets. The codes in data_prepare/data_name.py process the raw datasets in the data/name/raw folders and output the sampled training, calibration, and test sets in the data/name/processed folders.

Experiment results and source codes correspondence

The table below presents the correspondence between experiment results and source codes.

SectionPresentationFolderExperiment codesPlot/Table codes
Sec 6.2Table 1correlationdistance_correlation.pytable_correlation_result.py
Sec 6.3Figure 3mainWRCP_main.pyplot_W_distance_min.py
Sec 6.4Figure 4,11-18mainWRCP_main.py, CQR_main.pyplot_main_result.py
Sec 6.5Figure 5mainWRCP_main.pyplot_ablation.py
Appendix CFigure 8unweightedWRCP_unweighted.pyplot_unweighted_result.py
Appendix G.1Figure 19guaranteedWCCP_with_WRCP_guarantee.py, WRCP_guaranteed.pyplot_guaranteed_result.py
Appendix G.2Figure 20hybridWRWC_hybrid.pyplot_hybrid_result.py