relaxit, python package
Project description
<img src="assets/logo.svg" width="200px" />
<h1> Just Relax It </h1>
<p align="center"> Discrete Variables Relaxation </p>
<a href="https://pytorch.org/docs/stable/distributions.html">
<img alt="Compatible with PyTorch" src="https://img.shields.io/badge/Compatible\_with\_Pytorch\-ef4c2c">
</a>
<a href="https://docs.pyro.ai/en/dev/distributions.html">
<img alt="Inspired by Pyro" src="https://img.shields.io/badge/Inspired\_by\_Pyro\-fecd08">
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/tree/main/tests">
<img alt="Coverage\_2" src="https://github.com/intsystems/discrete\-variables\-relaxation/actions/workflows/test.yml/badge.svg" />
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/tree/main/tests">
<img alt="Coverage" src="coverage\-badge.svg" />
</a>
<a href="https://intsystems.github.io/discrete\-variables\-relaxation">
<img alt="Docs" src="https://github.com/intsystems/discrete\-variables\-relaxation/actions/workflows/docs.yml/badge.svg" />
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/blob/main/LICENSE">
<img alt="License" src="https://badgen.net/github/license/intsystems/discrete\-variables\-relaxation?color=green" />
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/intsystems/discrete\-variables\-relaxation" />
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/issues">
<img alt="Issues" src="https://img.shields.io/github/issues\-closed/intsystems/discrete\-variables\-relaxation?color=0088ff" />
</a>
<a href="https://github.com/intsystems/discrete\-variables\-relaxation/pulls">
<img alt="GitHub Pull Requests" src="https://img.shields.io/github/issues\-pr\-closed/intsystems/discrete\-variables\-relaxation?color=7f29d6" />
</a>
📬 Assets
==========
-
Technical Meeting 1 - Presentation <https://github.com/intsystems/discrete-variables-relaxation/blob/main/assets/presentation_tm1.pdf>_ -
Technical Meeting 2 - Jupyter Notebook <https://github.com/intsystems/discrete-variables-relaxation/blob/main/basic/basic_code.ipynb>_ -
Technical Meeting 3 — Jupyter Notebook <https://github.com/intsystems/discrete-variables-relaxation/blob/main/demo/vizualization.ipynb>_ -
Blog Post <https://github.com/intsystems/discrete-variables-relaxation/blob/main/assets/blog-post.pdf>_ -
Documentation <https://intsystems.github.io/discrete-variables-relaxation/train.html>_ -
Tests <https://github.com/intsystems/discrete-variables-relaxation/tree/main/tests>_
💡 Motivation
==============
For lots of mathematical problems we need an ability to sample discrete random variables.
The problem is that due to continuos nature of deep learning optimization, the usage of truely discrete random variables is infeasible.
Thus we use different relaxation method.
One of them, Concrete distribution](https://arxiv.org/abs/1611.00712) or [Gumbel-Softmax <https://arxiv.org/abs/1611.01144>_ or Gumbel-Softmax <https://arxiv.org/abs/1611.01144>_ (this is one distribution proposed in parallel by two research groups) is implemented in different DL packages.
In this project we implement different alternatives to it.
<img src="assets/overview.png" width="600"/>
🗃 Algorithms
==============
x] [Relaxed Bernoulli <http://proceedings.mlr.press/v119/yamada20a/yamada20a.pdf>_x] [Correlated relaxed Bernoulli <https://openreview.net/pdf?id=oDFvtxzPOx>_x] [Gumbel-softmax TOP-K <https://arxiv.org/pdf/1903.06059>_x] [Straight-Through Bernoulli <https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=62c76ca0b2790c34e85ba1cce09d47be317c7235>_x] [Invertible Gaussian <https://arxiv.org/abs/1912.09588>_ with KL implementedx] [Hard Concrete <https://arxiv.org/pdf/1712.01312>_x] [REINFORCE <http://www.cs.toronto.edu/~tingwuwang/REINFORCE.pdf>_x] [Logit-Normal](https://en.wikipedia.org/wiki/Logit-normal_distribution) and [Laplace-form approximation of Dirichlet <https://stats.stackexchange.com/questions/535560/approximating-the-logit-normal-by-dirichlet>_ andLaplace-form approximation of Dirichlet <https://stats.stackexchange.com/questions/535560/approximating-the-logit-normal-by-dirichlet>_
🎮 Demo
========
For demonstration purposes, we have implemented a simple VAE with discrete latents. Our code is available here <https://github.com/intsystems/discrete-variables-relaxation/tree/main/demo>_.
Each of the discussed relaxation techniques allowed us to learn the latent space with the corresponding distribution.
📚 Stack
=========
Some of the alternatives for GS were implemented in pyro <https://docs.pyro.ai/en/dev/distributions.html>_, so we base our library on their codebase.
🧩 Some details
================
To make to library consistent, we integrate imports of distributions from pyro and torch into the library, so that all the categorical distributions can be imported from one entrypoint.
👥 Contributors
================
Daniil Dorin <https://github.com/DorinDaniil>_ (Basic code writing, Final demo, Algorithms)Igor Ignashin <https://github.com/ThunderstormXX>_ (Project wrapping, Documentation writing, Algorithms)Nikita Kiselev <https://github.com/kisnikser>_ (Project planning, Blog post, Algorithms)Andrey Veprikov <https://github.com/Vepricov>_ (Tests writing, Documentation writing, Algorithms)- You are welcome to contribute to our project!
🔗 Useful links
================
About top-k GS <https://uvadlc-notebooks.readthedocs.io/en/latest/tutorial_notebooks/DL2/sampling/subsets.html>_VAE implementation with different latent distributions <https://github.com/kampta/pytorch-distributions>_KL divergence between Dirichlet and Logistic-Normal implemented in R <https://rdrr.io/cran/Compositional/src/R/kl.diri.normal.R>_About score function (SF) and pathwise derivate (PD) estimators, VAE and REINFORCE <https://arxiv.org/abs/1506.05254>_ and pathwise derivate (PD) estimators, VAE and REINFORCE](https://arxiv.org/abs/1506.05254)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file relaxit-0.1.0.tar.gz.
File metadata
- Download URL: relaxit-0.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ceb8c3e1c6c4368979768fa950c7dbd9c5d8538300e006ce69d1e518bc50329
|
|
| MD5 |
7b905a0b6d6ea38cae8f55d7e3e18c0b
|
|
| BLAKE2b-256 |
0e5aa50e1c14bdc1e6b1cf7f3a6040f196ce77dffaa8290e6e33eb345b44794d
|
File details
Details for the file relaxit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: relaxit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6c2d29d673c539f72a1d48d36e64faf58afdcaed86f4dd4fc263a85016e99f2
|
|
| MD5 |
3586c312728f603f3cedabaa6b15c409
|
|
| BLAKE2b-256 |
0f54d572576dbf3678cddf1f34cd3ad5685d7ef04b2bcccd51e2eec7f4dcb706
|