Skip to content

Code accompanying the paper "Combining Evidence Across Filtrations Using Adjusters"

License

Notifications You must be signed in to change notification settings

yjchoe/CombiningEvidenceAcrossFiltrations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ecombine

Python code accompanying our paper, Combining Evidence Across Filtrations.

eLifting

Code Overview

ecombine/ is the source package that implements adjusters/calibrators, e-processes, data generators, and plotting functions.

The following notebooks contain code and plots related to various numerical results in the paper.

Main results:

Extra results:

Installation

git clone https://github.com/yjchoe/CombiningEvidenceAcrossFiltrations
cd CombiningEvidenceAcrossFiltrations

pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

Sample Usage

The following code combines the UI and conformal e-processes for testing exchangeability given a binary data sequence:

import numpy as np
import matplotlib.pyplot as plt

import ecombine as ec

# generate data with a "shock" changepoint
rng = np.random.default_rng(2024)
T = 2000
p, q = 0.5, 0.2
change_loc, change_len = 0.2, 0.04
x = ec.data.exch.generate_binary_changepoint(
    p=p, q=q, size=T, 
    change_loc=change_loc, change_len=change_len, rng=rng,
)

# compute e-processes; the conformal variant requires adjustment for anytime-validity wrt data
e_ui = ec.eprocess_exch_universal(x)
e_conf = ec.eprocess_exch_conformal(
    x, jump=0.01, jumper_weights=(1/3, 1/3, 1/3), rng=rng,
)

# combined e-process is valid at any data-dependent stopping times!
e_combined = 0.5 * e_ui + 0.5 * ec.adjuster(e_conf)

# plotting
ec.set_theme()
fg = ec.plot_eprocess(
    [e_ui, e_conf, e_combined],
    ["UI", "Conformal", "eLift+Avg"],
    title="E-processes for Testing Exchangeability",
)
plt.show()

See further usage in nb_exchangeability_elifting_alternative.ipynb.

Code License

MIT

Authors

YJ Choe and Aaditya Ramdas

Citation

If you use parts of our work, please cite our paper as follows:

APA:

Choe, Y. J., & Ramdas, A. (2024). Combining evidence across filtrations. arXiv preprint arXiv:2402.09698.

BibTeX:

@article{choe2024combining,
  title={Combining Evidence Across Filtrations},
  author={Choe, Yo Joong and Ramdas, Aaditya},
  journal={arXiv preprint arXiv:2402.09698},
  year={2024}
}

About

Code accompanying the paper "Combining Evidence Across Filtrations Using Adjusters"

Resources

License

Stars

Watchers

Forks