This repository contains code and text to reproduce our paper,
R. Giordano*, M. Ingram* & T. Broderick (2023). Black Box Variational Inference with a Deterministic Objective: Faster, More Accurate, and Even More Black Box.
*= equal contribution first authors. arXiv:2304.05527
To compile, edit the header of the makefile to point to this repositry as
well as the experiments repository (which is currently martiningram/dadvi-experiments).
Then run make all. The requirements needed for R to run are listed in r_requirements.txt,
so please install these first.
Note that you should be able to compile the paper using the postprocessed experiments data included in this repo. To re-run the experiments, see martiningram/dadvi-experiments. Note that the experiments are time consuming and disk-intensive, and so are not included in the present repository.
The knitr setup may seem a little complicated at first, but I like how fast it is to recompile, and how modular it makes everything.
The short summary of how it is used for a particular experiment is:
-
The minimal amount of data needed to generate tables and figures is saved in an Rdata file stored in
experiments_data. -
A line in
figures_knitr/load_data.Rto loads the experiment data into anRenvironment. -
To refer in the text to any key quantities from the experiment, we add lines to
figures_knitr/define_macros.R. -
We add standalone
.Rfiles tofigures_knitrto generate individual figures and tables. -
We define macros in
figures_knitr.Rnwthat source your figure and table files. Don't editfigures_knitr.tex, that file is overwritten! -
To compile
figures_knitr.Rnwintofigures_knitr.tex, runmake figutes_knitr.tex. To force re-running knitr, runmake recompile_knitr. If it fails, debug as in step (8). -
Use the macros in the main latex text to place figures, tables, and numbers where you want them. Note that you can move the figures around and recompile LaTeX with no additional knitting.
-
For debugging, it can be helpful to check the R output with
debugging.R, then the tex output by looking at (but not editing)figures_knitr.tex. If needed, you can also setknitr_debug <- TRUEinfigures_knitr.Rnwto see verbose R output in LaTeX after knitting.