.. Pyro Tutorials documentation master file, created by
sphinx-quickstart on Tue Oct 31 11:33:17 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Getting Started With Pyro: Tutorials, How-to Guides and Examples
================================================================
Welcome! This page collects tutorials written by the Pyro community.
If you're having trouble finding or understanding anything here,
please don't hesitate to ask a question on our `forum `_!
New users: getting from zero to one
------------------------------------
If you're new to probabilistic programming or variational inference,
you might want to start by reading the series :ref:`introductory-tutorials`.
If you're new to PyTorch, you may also benefit from reading the official introduction `"Deep Learning with PyTorch." `_
After that, you're ready to get started using Pyro! (Yes, really!)
Follow `the instructions on the front page to install Pyro `_
and look carefully through the series :ref:`practical-pyro-and-pytorch`,
especially the :doc:`first Bayesian regression tutorial `.
This tutorial goes step-by-step through solving a simple Bayesian machine learning problem with Pyro,
grounding the concepts from the introductory tutorials in runnable code.
Industry users interested in serving predictions from a trained model in C++ should also read :doc:`the PyroModule tutorial `.
Most users who reach this point will also find our :doc:`guide to tensor shapes in Pyro ` essential reading.
Pyro makes extensive use of the behavior of `"array broadcasting" `_
baked into PyTorch and other array libraries to parallelize models and inference algorithms,
and while it can be difficult to understand this behavior initially, applying the intuition and rules of thumb there
will go a long way toward making your experience smooth and avoiding nasty shape errors.
Core functionality: Deep learning, discrete variables and customizable inference
---------------------------------------------------------------------------------
A basic familiarity with this introductory material is all you will need to dive right into exploiting Pyro's two biggest strengths:
integration with deep learning and automated exact inference for discrete latent variables.
The former is described with numerous examples in the series :ref:`deep-generative-models`.
All are elaborations on the basic idea of the variational autoencoder, introduced in great detail in :doc:`the first tutorial of this series `.
Pyro's facility with discrete latent variable models like the hidden Markov model is surveyed in the series :ref:`discrete-latent-variables`.
Making use of this in your own work will require careful reading of :doc:`our overview and programming guide ` that opens this series.
Another feature of Pyro is its programmability, the subject of a series of tutorials in :ref:`customizing-inference`.
Users working with large models where only part of the model needs special attention
may be interested in `pyro.contrib.easyguide `_, introduced in :doc:`the first tutorial of the series `.
Meanwhile, machine learning researchers interested in developing variational inference algorithms may wish to peruse
:doc:`the guide to implementing custom variational objectives `,
and a companion example that walks through :doc:`implementing "Boosting BBVI" `.
Particularly enthusiastic users and potential contributors, especially those interested in contributing to Pyro's core components,
may even be interested in how Pyro itself works under the hood, partially described in the series :ref:`understanding-pyros-internals`.
The :doc:`mini-pyro example ` contains a complete and heavily commented implementation of a small version of the Pyro language in just a few hundred lines of code,
and should serve as a more digestable introduction to the real thing.
Tools for specific problems
-----------------------------
Pyro is a mature piece of open-source software with "batteries included."
In addition to the core machinery for modelling and inference,
it includes a large toolkit of dedicated domain- or problem-specific modelling functionality.
One particular area of strength is time-series modelling via `pyro.contrib.forecasting `_,
a library for scaling hierarchical, fully Bayesian models of multivariate time series to thousands or millions of series and datapoints.
This is described in the series :ref:`time-series`.
Another area of strength is probabilistic machine learning with Gaussian processes.
`pyro.contrib.gp `_, described in the series :ref:`gaussian-processes`,
is a library within Pyro implementing a variety of exact or approximate Gaussian process models compatible with Pyro's inference engines.
Pyro is also fully compatible with `GPyTorch `_, a dedicated library for scalable GPs,
as described in `their Pyro example series `_.
List of Tutorials
==================
.. toctree::
:maxdepth: 1
:caption: Introductory Tutorials
:name: introductory-tutorials
intro_part_i
intro_part_ii
svi_part_i
svi_part_ii
svi_part_iii
svi_part_iv
.. toctree::
:maxdepth: 1
:caption: Practical Pyro and PyTorch
:name: practical-pyro-and-pytorch
bayesian_regression
bayesian_regression_ii
tensor_shapes
modules
jit
svi_horovod
.. toctree::
:maxdepth: 1
:caption: Deep Generative Models
:name: deep-generative-models
vae
ss-vae
cvae
normalizing_flows_i
dmm
air
scanvi
cevae
sparse_gamma
prodlda
.. toctree::
:maxdepth: 1
:caption: Discrete Latent Variables
:name: discrete-latent-variables
enumeration
gmm
dirichlet_process_mixture
toy_mixture_model_discrete_enumeration
hmm
capture_recapture
mixed_hmm
einsum
lda
.. toctree::
:maxdepth: 1
:caption: Customizing Inference
:name: customizing-inference
mle_map
easyguide
custom_objectives
boosting_bbvi
neutra
sparse_regression
autoname_examples
.. toctree::
:maxdepth: 1
:caption: Application: Time Series
:name: time-series
forecasting_i
forecasting_ii
forecasting_iii
forecasting_dlm
stable
forecast_simple
timeseries
.. toctree::
:maxdepth: 1
:caption: Application: Gaussian Processes
:name: gaussian-processes
gp
gplvm
bo
dkl
.. toctree::
:maxdepth: 1
:caption: Application: Epidemiology
:name: epidemiology
epi_intro
epi_sir
epi_regional
sir_hmc
.. toctree::
:maxdepth: 1
:caption: Application: Experimental Design
:name: optimal-experiment-design
working_memory
elections
.. toctree::
:maxdepth: 1
:caption: Application: Object Tracking
:name: object-tracking
tracking_1d
ekf
.. toctree::
:maxdepth: 1
:caption: Other Inference Algorithms
baseball
mcmc
lkj
csis
smcfilter
inclined_plane
RSA-implicature
RSA-hyperbole
.. toctree::
:maxdepth: 1
:caption: Understanding Pyro's Internals
:name: understanding-pyros-internals
minipyro
effect_handlers
contrib_funsor_intro_i
contrib_funsor_intro_ii
hmm_funsor
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`