Skip to main content

Stochastic Deep Learning for PyTorch

Project description

General Stochastic Automatic Differentiation for Pytorch

Documentation Status

Storchastic is a PyTorch library for stochastic gradient estimation in Deep Learning [1]. Many state of the art deep learning models use gradient estimation, in particular within the fields of Variational Inference and Reinforcement Learning. While PyTorch computes gradients of deterministic computation graphs automatically, it will not estimate gradients on stochastic computation graphs [2].

With Storchastic, you can easily define any stochastic deep learning model and let it estimate the gradients for you. Storchastic provides a large range of gradient estimation methods that you can plug and play, to figure out which one works best for your problem. Storchastic provides automatic broadcasting of sampled batch dimensions, which increases code readability and allows implementing complex models with ease.

When dealing with continuous random variables and differentiable functions, the popular reparameterization method [3] is usually very effective. However, this method is not applicable when dealing with discrete random variables or non-differentiable functions. This is why Storchastic has a focus on gradient estimators for discrete random variables, non-differentiable functions and sequence models.

Documentation on Read the Docs.

Example: Discrete Variational Auto-Encoder

Installation

In your virtual Python environment, run pip install storchastic

Requires Pytorch 1.8 and Pyro. The code is build using Python 3.8.

Algorithms

Feel free to create an issue if an estimator is missing here.

  • Reparameterization [1, 3]
  • Score Function (REINFORCE) with Moving Average baseline [1, 4]
  • Score Function with Batch Average Baseline [5, 6]
  • Expected value for enumerable distributions
  • (Straight through) Gumbel Softmax [7, 8]
  • LAX, RELAX [9]
  • REBAR [10]
  • REINFORCE Without Replacement [6]
  • Unordered Set Estimator [13]
  • ARM [15]

In development

  • Memory Augmented Policy Optimization [11]
  • Rao-Blackwellized REINFORCE [12]

Planned

  • Measure valued derivatives [1, 14]
  • Automatic Credit Assignment [16]
  • ...

References

Cite

To cite Storchastic, please cite this preprint:

@article{van2021storchastic,
  title={Storchastic: A Framework for General Stochastic Automatic Differentiation},
  author={van Krieken, Emile and Tomczak, Jakub M and Teije, Annette ten},
  journal={arXiv preprint arXiv:2104.00428},
  year={2021}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

storchastic-0.3.4.tar.gz (67.9 kB view details)

Uploaded Source

File details

Details for the file storchastic-0.3.4.tar.gz.

File metadata

  • Download URL: storchastic-0.3.4.tar.gz
  • Upload date:
  • Size: 67.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.5

File hashes

Hashes for storchastic-0.3.4.tar.gz
Algorithm Hash digest
SHA256 605265c013c587b69080c5a65dbe9a75b965f90339afc07c47016437f55769a8
MD5 ff022abac166b9451262cf3319b14537
BLAKE2b-256 32448ae9b0bf91d24d634bf8b6ad3a36c0429fc7f5adf4bf3662162d9baf3247

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page