https://github.com/rpatrik96/ima-vae
This is the code for the paper Embrace the Gap: VAEs perform Independent Mechanism Analysis, showing that optimizing the ELBO is equivalent to optimizing the IMA-regularized log-likelihood under certain assumptions (e.g., small decoder variance).
https://github.com/rpatrik96/ima-vae
disentanglement dsprites ica independent-component-analysis pytorch pytorch-lightning vae variational-autoencoder variational-inference wandb
Last synced: 12 months ago
JSON representation
This is the code for the paper Embrace the Gap: VAEs perform Independent Mechanism Analysis, showing that optimizing the ELBO is equivalent to optimizing the IMA-regularized log-likelihood under certain assumptions (e.g., small decoder variance).
- Host: GitHub
- URL: https://github.com/rpatrik96/ima-vae
- Owner: rpatrik96
- License: apache-2.0
- Created: 2021-11-25T10:55:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T13:43:43.000Z (about 2 years ago)
- Last Synced: 2025-06-02T10:44:26.318Z (about 1 year ago)
- Topics: disentanglement, dsprites, ica, independent-component-analysis, pytorch, pytorch-lightning, vae, variational-autoencoder, variational-inference, wandb
- Language: Jupyter Notebook
- Homepage:
- Size: 11.4 MB
- Stars: 23
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
---
# Embrace the Gap: VAEs perform Independent Mechanism Analysis
[//]: # ([](https://arxiv.org/abs/2206.02416))
[](https://openreview.net/forum?id=G4GpqX4bKAH)
[//]: # ([](https://papers.nips.cc/book/advances-in-neural-information-processing-systems-31-2018))
[//]: # ([](https://papers.nips.cc/book/advances-in-neural-information-processing-systems-31-2018) )
[](https://arxiv.org/abs/2206.02416)

[](https://zenodo.org/badge/latestdoi/431811003)
## Description
This is the code for the paper _Embrace the Gap: VAEs perform Independent Mechanism Analysis_, showing that optimizing the ELBO is equivalent to optimizing the IMA-regularized log-likelihood under certain assumptions (e.g., small decoder variance).
## How to run
First, install dependencies
```bash
# clone ima_vae
git clone --recurse-submodules https://github.com/rpatrik96/ima-vae
# if forgot to pull submodules, run
git submodule update --init
# install ima_vae
cd ima-vae
pip install -e .
pip install -r requirements.txt
# install spriteworld
pip install -e ./spriteworld
# install submodule requirements
pip install --requirement ima/requirements.txt --quiet
pip install --requirement tests/requirements.txt --quiet
pip install --requirement spriteworld/requirements.txt --quiet
# install pre-commit hooks (only necessary for development)
pre-commit install
```
Next, navigate to the `ima-vae` directory and run `ima_vae/cli.py.
```bash
python3 ima_vae/cli.py fit --help
python3 ima_vae/cli.py fit --config configs/trainer.yaml --config configs/synth/moebius.yaml --model.prior=beta
```
### Hyperparameter optimization
First, you need to log into `wandb`
```bash
wandb login #you will find your API key at https://wandb.ai/authorize
```
Then you can create and run the sweep
```bash
wandb sweep sweeps/synth/mlp/finding_optimal_gamma_uniform.yaml # returns sweep ID
wandb agent --count= # when used on a cluster, set it to one and start multiple processes
```
## Citation
```
@inproceedings{
reizinger_embrace_2022,
title={Embrace the Gap: {VAE}s Perform Independent Mechanism Analysis},
author={Patrik Reizinger and Luigi Gresele and Jack Brady and Julius Von K{\"u}gelgen and Dominik Zietlow and Bernhard Sch{\"o}lkopf and Georg Martius and Wieland Brendel and Michel Besserve},
booktitle={Advances in Neural Information Processing Systems},
editor={Alice H. Oh and Alekh Agarwal and Danielle Belgrave and Kyunghyun Cho},
year={2022},
url={https://openreview.net/forum?id=G4GpqX4bKAH}
}
```