This repository provides a collection of tutorials demonstrating how to implement SVGD using Python and PyTorch. It includes toy examples of vanilla SVGD and annealed SVGD applied to problems ranging from low-dimensional to high-dimensional and multimodal distributions.
Corrales M.
This repository is organized as follows:
- 📂 svgdtutorial: python library containing routines for the totorials provided (for now empty).
- 📂 data: folder containing data (or instructions on how to retrieve the data).
- 📂 notebooks: set of jupyter notebooks reproducing the tutorials (see below for more details).
- 📂 scripts: set of python scripts used to run multiple experiments (for now empty).
The following notebooks are provided:
- 📙
00_Theory_Recap.ipynb: Brief recap about Deterministic Inverse problems and Variational inference. - 📙
00_SVGD_Notes.ipynb: Brief derivation of SVGD. - 📙
01_SVGD_gaussian.ipynb: SVGD tutorial for one simple gaussian distribution. - 📙
02_ASVGD_multimodal.ipynb: Annealed SVGD tutorial for multi-modal distributions. - 📙
03_SVGD_high_dimensions.ipynb: SVGD tutorial for high-dimensional distributions.
The theory notebooks have also been shared as slides in HTML format. You can find them in the following folder 📂 notebooks/html/
To ensure reproducibility of the results, we suggest using the environment.yml file when creating an environment. (Use environment_cpu.yml or environment_gpu.yml depending on your needs)
For example, simply run:
./install_env_cpu.sh
It will take some time, if at the end you see the word Done! on your terminal you are ready to go. Remember to always activate the environment by typing:
conda activate svgdtutorial_cpu
After that you can simply install your package:
pip install .
or in developer mode:
pip install -e .
Note
All experiments have been carried on a Intel(R) Xeon(R) CPU @ 2.10GHz equipped with a single NVIDIA GEForce RTX 3090 GPU, and an Apple M3 Max. Different environment configurations may be required for different combinations of workstation and GPU.
Important
This implementation was inspired on:
