derivatives, tqdm, torch
The processed data are
./data_preparation/val_cifar10_resnet18_cal.pt
./data_preparation/test_cifar10_resnet18_cal.pt
We also provide the code to generate them from scratch: first download the resnet18 pretrained on CIFAR10 from https://drive.google.com/file/d/1gkPX4HKhwyXl820yUF6LEjXnhNzWTh99/view?usp=sharing
. Then run the following script:
cd data_preparation
python cifar10_prepare.py
cd -
The processed data are
./data_preparation/val_arxiv_linear_cal.pt
./data_preparation/test_arxiv_linear_cal.pt
We also provide the code to generate them from scratch: download arxiv-metadata-oai-snapshot.json
at data_preparation/data/
from https://www.kaggle.com/Cornell-University/arxiv
. Then run the following two jupyternotebooks sequentially:
Arxiv Data Process.ipynb
Arxiv Training.ipynb
python simulation_main.py --shift_process ${shift_process} --algo {algo} --seed {seed}
shift_process
isconstant_shift
,monotone_shift
,period_shift_{T_p}
orexp_period_shift_{k}
if we'd like to run the simulation with constant shift, monotone shift, periodic shift with periodT_p
, exponential periodic shift with exponential parameterk
.algo
isconst
,opt_const
,fth
,ftfwh_{w}
,ogd
if we choose the method asbase classifier
,opt fixed classifier
,Follow The HIstory
,Follow The Fixed Window History
with window sizew
,Online Gradient Descent
.- When we choose online gradient descent, run the above command with
--conf_type zero_one
if using finite difference to approximate the gradient or run it with--conf_type prob
python arxiv_main.py --algo {algo}
algo
isconst
,opt_const
,fth
,ftfwh_{w}
,ogd
if we choose the method asbase classifier
,opt fixed classifier
,Follow The HIstory
,Follow The Fixed Window History
with window sizew
,Online Gradient Descent
.- When we choose online gradient descent, run the above command with
--conf_type zero_one
if using finite difference to approximate the gradient or run it with--conf_type prob
This code corresponds to the following paper:
Ruihan Wu, Chuan Guo, Yi Su, and Kilian Q. Weinberger. Online Adaption to Label Distribution Shift. NeurIPS 2021.
@inproceedings{
wu2021online,
title={Online Adaptation to Label Distribution Shift},
author={Ruihan Wu and Chuan Guo and Yi Su and Kilian Q Weinberger},
booktitle={Advances in Neural Information Processing Systems},
editor={A. Beygelzimer and Y. Dauphin and P. Liang and J. Wortman Vaughan},
year={2021}
}