-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 94cd2ad
Showing
49 changed files
with
96,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Shengpu Tang | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Counterfactual-Augmented Importance Sampling for Semi-Offline Policy Evaluation | ||
|
||
This repository contains the source code for replicating all experiments in the NeurIPS 2023 paper, "Counterfactual-Augmented Importance Sampling for Semi-Offline Policy Evaluation". | ||
|
||
Repository content: | ||
|
||
- `synthetic/` contains code for the experiments on the toy bandit problems. | ||
- `sepsisSim/` contains code for the experiments on the sepsis simulator. | ||
|
||
If you use this code in your research, please cite the following publication: | ||
``` | ||
@inproceedings{tang2023counterfactual, | ||
title={Counterfactual-Augmented Importance Sampling for Semi-Offline Policy Evaluation}, | ||
author={Tang, Shengpu and Wiens, Jenna}, | ||
booktitle={Advances in Neural Information Processing Systems}, | ||
year={2023}, | ||
url={https://openreview.net/forum?id=dsH244r9fA} | ||
} | ||
``` | ||
|
||
## Synthetic domains - Bandits (Sec 5.1 & Appx E.1) | ||
- `bandit_compare-2state.ipynb`: Table 1, Appx E Table 3 | ||
- `bandit_compare-1state.ipynb`: Appx E Table 4 | ||
- `bandit_sweepW.ipynb`: Appx E Fig 7 (varying weights) | ||
- `bandit_sweepPcannot.ipynb`: Appx E Fig 8 (varying percent annotated and imputation) | ||
|
||
## Healthcare domain - Sepsis simulator (Sec 5.2 & Appx E.2) | ||
- Simulator based on publicly available code at https://github.com/clinicalml/gumbel-max-scm/tree/sim-v2 | ||
- Experiment code structure are inspired by https://github.com/MLD3/OfflineRL_ModelSelection and https://github.com/MLD3/OfflineRL_FactoredActions | ||
- The preparation steps are in `data-prep/`, which include the simulator source code as well as several notebooks for dataset generation. The output is saved to `data/` (ground-truth MDP parameters, ground-truth optimal policy, and optimal value functions) and `datagen/` (offline datasets). | ||
- The code for the main experiments is in `experiments/`. | ||
- `0-prepopulate_annotations.ipynb` preprocesses the data so that all counterfactual annotations are pre-populated. This step is run only once (instead of repeated for each experiment) as it takes a long time. The annotations are later replaced with different values or removed depending on the experiment. The output is saved to `results/vaso_eps_0_1-annotOpt_df_seed2_aug_step.pkl`. | ||
- Use `commands.sh` to run the experiments. | ||
- Run the following notebooks to generate tables and figures used in the paper: | ||
- `results.ipynb`: Table 2, Appx E Table 5 top, Appx E Fig 9 | ||
- `results-OIS-WIS.ipynb`: Appx E Table 5 bottom | ||
- `plots-analyses.ipynb`: Fig 5 left, Appx E Fig 10 | ||
- `plots-noisy[-v2].ipynb`: Fig 5 center, Appx E Fig 11 left¢er | ||
- `plots-missing.ipynb`: Fig 5 right, Appx E Fig 11 right | ||
- `plots--legend.ipynb`: figure legend used in Fig 5 and Fig 11 | ||
- `fig/` contains the main figures used in the paper. |
Oops, something went wrong.