Skip to content

Docs #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,41 @@

This repository implements an educational project for the Bayesian Multimodeling course. It implements algorithms for sampling from various distributions, using the implicit reparameterization trick.

## Описание

В этом репозитории реализован учебный проект для курса Байесовское мультимоделирование. В нем реализуются алгоритмы сэмплирования из различных распределений, используя implicit reparametriation trick.
## Scope
We plan to implement the following distributions in our library:
- Gaussian normal distribution (*)
- Dirichlet distribution (Beta distributions)(\*)
- Sampling from a mixture of distributions
- Sampling from the Student's t-distribution (**) (\*)
- Sampling from an arbitrary factorized distribution (***)

(\*) - this distribution is already implemented in torch using the explicit reparameterization trick, we will implement it for comparison

(\*\*) - this distribution is added as a backup, their inclusion is questionable

(\*\*\*) - this distribution is not very clear in implementation, its inclusion is questionable

## Stack

We plan to inherit from the torch.distribution.Distribution class, so we need to implement all the methods that are present in that class.

## Usage
In this example, we demonstrate the application of our library using a Variational Autoencoder (VAE) model, where the latent layer is modified by a normal distribution.
```
>>> import torch.distributions.implicit as irt
>>> params = Encoder(inputs)
>>> gauss = irt.Normal(*params)
>>> deviated = gauss.rsample()
>>> outputs = Decoder(deviated)
```
In this example, we demonstrate the use of a mixture of distributions using our library.
```
>>> import irt
>>> params = Encoder(inputs)
>>> mix = irt.Mixture([irt.Normal(*params), irt.Dirichlet(*params)])
>>> deviated = mix.rsample()
>>> outputs = Decoder(deviated)
```

## Links
- [LinkReview](https://github.com/intsystems/implitic-reparametrization-trick/blob/main/linkreview.md)
Expand Down
19 changes: 19 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))

project = 'Implicit Reparametrization Trick'
author = 'Matvei Kreinin, Maria Nikitina, Petr Babkin, Irina Zaboryanskaya'
release = '0.1'

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
]

templates_path = ['_templates']
exclude_patterns = []

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
13 changes: 13 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. Implicit Reparametrization Trick documentation master file, created by
sphinx-quickstart on Mon Oct 10 10:00:00 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to Implicit Reparametrization Trick's documentation!
===========================================================

.. toctree::
:maxdepth: 2
:caption: Contents:

modules
1 change: 1 addition & 0 deletions doc/source/info.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../../README.md
5 changes: 5 additions & 0 deletions doc/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Modules
=======

.. automodule:: torch.distributions.implicit
:members:
Loading