Code package gatsbi implementing method and experiments described in the associated manuscript "GATSBI: Generative Adversarial Training for Simulation-Based Inference"
The code depends both on the simulation-based inference package sbi and the benchmark framework sbibm.
With a working Python environment, install gatsbi using pip:
pip install "git+https://github.com/mackelab/gatsbi"
For a minimal demonstration of how to use gatsbi see quickstart.ipynb.
The paper describes results for the following experiments: 2 benchmark tasks, the shallow water model, and a noisy camera model.
Code for setting up priors, simulator, GAN networks and any other pre-/post-processing code is available inside gatsbi.task_utils.
Hyperparameter settings for each of the experiments are available in tasks/
To reproduce the exact experiments described in the paper, use the following run_scripts from the repository's root directory (note that this relies on wandb to log experiments)
run_benchmarks.pyfor benchmark taskspython run_benchmarks.py --project_name="Benchmarks" --task_name="two_moons"task_name=slcportwo_moonsfor amortized GATSBI,slcp_seqortwo_moons_seqfor sequential GATSBI.run_highdim_applications.pyfor high dimensional taskspython run_highdim_applications.py --project_name="High Dimensional Applications" --task_name="shallow_water_model"task_name=shallow_water_modelorcamera_model.run_inference_nle/npe/nre.pyfor running NPE / NLE / NRE on shallow water model.python run_inference_nle/npe/nre.py
Note that we do not provide training data for the shallow water model in this repository. Please use sample_shallow_water.py to generate training samples locally.
Code to reproduce the figures in the paper is available in plotting_code, along with the required data plotting_code/plotting_data, and the final plots plotting_code/plots. Note that accessing the data requires Git LFS installation.