bc-cpit
Bias-corrected conformal PIT calibration for sample-based predictive distributions.
Install
pip install bc-cpit
Development:
git clone https://github.com/egpivo/bc-cpit.git
cd cpit
pip install -e ".[dev]"
Quick start
from cpit.bc import fit_global_affine, apply_affine
from cpit import fit_conformal_calibrator, get_weighted_samples_at_x
from cpit import quantile_from_weighted_samples, central_interval_from_weighted_samples
# 1. Bias correction
params = fit_global_affine(y_bias, y_bias_samples)
# 2. Conformal calibration
cal_samples_adj = [apply_affine(s, params) for s in cal_samples]
_, c_hat = fit_conformal_calibrator(cal_samples_adj, y_cal)
# 3. Inference
y_pts, weights = get_weighted_samples_at_x(y_test_samples, params, c_hat)
q80 = quantile_from_weighted_samples(y_pts, weights, 0.80)
lo, hi = central_interval_from_weighted_samples(y_pts, weights, alpha=0.10)
x-dependent (GAM) correction:
from cpit.bc import fit_x_dependent_affine_gam
params_gam = fit_x_dependent_affine_gam(x_bias, y_bias, y_bias_samples)
y_pts, weights = get_weighted_samples_at_x(y_test_samples, params_gam, c_hat, x=x_test)
High-level pipeline:
from cpit.pipeline import run_pipeline, predict_interval
state = run_pipeline(X, y, generator_fn)
lo, hi = predict_interval(state, X_test, y_samples_test, alpha=0.10)
Reproduce paper results
make test # unit tests
make run-sim # Designs 1/2/3 simulations (§5)
make pit-figures # PIT histogram figures
make run-wb2 # WB2 application: Taiwan + Europe (§6)
Layout
cpit/ Python package
bc/ bias correction (fit, apply)
baselines/ competing methods
evaluation/ metrics, PIT histograms, diagnostics
calibrator.py / pit.py / inference.py / weighted_samples.py / pipeline.py
examples/ orchestration scripts (call cpit)
simulation/ §5 designs 1–3
real_data/ §6 WB2 Taiwan + Europe
Citation
The paper is currently being submitted to arXiv; the entry below will be updated with the final arXiv ID once it is live.
If you use this package, please cite:
Wang, W.-T., Tzeng, S., Fan, Y.-T., & Huang, H.-C. (2026). Calibrated Predictive Distributions from Sample-Based Generators. arXiv preprint arXiv:XXXX.XXXXX.
@article{wang2026calibrated,
title = {Calibrated Predictive Distributions from Sample-Based Generators},
author = {Wang, Wen-Ting and Tzeng, ShengLi and Fan, Yu-Ting and Huang, Hsin-Cheng},
journal = {arXiv preprint arXiv:XXXX.XXXXX},
year = {2026}
}
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bc_cpit-1.0.0.tar.gz.
File metadata
- Download URL: bc_cpit-1.0.0.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c1e2b7aacec5bce34785f3081a8fe1adc2a174581a3744718426bf447e1202c
|
|
| MD5 |
f65e3961ee7ca79e6fe8a6f5cf19e169
|
|
| BLAKE2b-256 |
448e1feb218c20882cb75aa11f4138bc79fcd6bb96e02bd1836bd37d0175dcf2
|
File details
Details for the file bc_cpit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bc_cpit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f62335bdb5ae9c2b324362c67d8efc12245ed54b2f9fd78fc959277f907a24
|
|
| MD5 |
7225a77729f37c923d38ba3bc191c557
|
|
| BLAKE2b-256 |
80bb25166f3d495745eb1992649fa331d9f8c9b863bfaee0755e6ee72499a487
|