Pyro-ppl

Latest version: v1.9.1

Safety actively analyzes 685838 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 6

0.4

Pyro 0.2 supports PyTorch 0.4. See PyTorch [release notes](https://github.com/pytorch/pytorch/releases/tag/v0.4.0) for comprehensive changes. The most important change is that `Variable` and `Tensor` have been merged, so you can now simplify
diff
- pyro.param("my_param", Variable(torch.ones(1), requires_grad=True))
+ pyro.param("my_param", torch.ones(1))


PyTorch distributions

PyTorch's [torch.distributions](http://pytorch.org/docs/0.4.0/distributions.html) library is now Pyro’s main source for distribution implementations. The Pyro team helped create this library by collaborating with Adam Paszke, Alican Bozkurt, Vishwak Srinivasan, Rachit Singh, Brooks Paige, Jan-Willem Van De Meent, and many other contributors and reviewers. See the [Pyro wrapper docs](http://pyro-ppl.readthedocs.io/en/0.2.0-release/distributions.html#pytorch-distributions) for wrapped PyTorch distributions and the [Pyro distribution docs](http://pyro-ppl.readthedocs.io/en/0.2.0-release/distributions.html#pyro-distributions) for Pyro-specific distributions.

Constrained parameters

Parameters can now be constrained easily using notation like
python
from torch.distributions import constraints

pyro.param(“sigma”, torch.ones(10), constraint=constraints.positive)

See the [torch.distributions.constraints](http://pytorch.org/docs/0.4.0/distributions.html#module-torch.distributions.constraints) library and all of our Pyro [tutorials](http://pyro.ai/examples) for example usage.

Arbitrary tensor shapes

Arbitrary tensor shapes and batching are now supported in Pyro. This includes support for nested batching via `iarange` and support for batched multivariate distributions. The `iarange` context and `irange` generator are now much more flexible and can be combined freely. With power comes complexity, so check out our [tensor shapes tutorial](http://pyro.ai/examples/tensor_shapes.html) (hint: you’ll need to use [`.expand_by()`](http://pyro-ppl.readthedocs.io/en/0.2.0-release/distributions.html#pyro.distributions.TorchDistributionMixin.expand_by) and [`.independent()`](http://pyro-ppl.readthedocs.io/en/0.2.0-release/distributions.html#pyro.distributions.TorchDistributionMixin.independent)).

Parallel enumeration

Discrete enumeration can now be parallelized. This makes it especially easy and cheap to enumerate out discrete latent variables. Check out the [Gaussian Mixture Model tutorial](http://pyro.ai/examples/gmm.html) for example usage. To use parallel enumeration, you'll need to first configure sites, then use the `TraceEnum_ELBO` losss:
python
def model(...):
...

config_enumerate(default="parallel") configures sites
def guide(...):
with pyro.iarange("foo", 10):
x = pyro.sample("x", dist.Bernoulli(0.5).expand_by([10]))
...

svi = SVI(model, guide, Adam({}),
loss=TraceEnum_ELBO(max_iarange_nesting=1)) specify loss
svi.step()


Markov chain monte carlo via HMC and NUTS

This release adds experimental support for gradient-based Markov Chain Monte Carlo inference via Hamiltonian Monte Carlo [`pyro.infer.HMC`](http://pyro-ppl.readthedocs.io/en/0.2.0-release/mcmc.html#module-pyro.infer.mcmc.hmc) and the No U-Turn Sampler [`pyro.infer.NUTS`](http://pyro-ppl.readthedocs.io/en/0.2.0-release/mcmc.html#module-pyro.infer.mcmc.nuts). See the [docs](http://pyro-ppl.readthedocs.io/en/0.2.0-release/mcmc.html) and [example](https://github.com/uber/pyro/blob/dev/examples/baseball.py) for details.

Gaussian Processes

A new Gaussian Process module [pyro.contrib.gp](http://pyro-ppl.readthedocs.io/en/0.2.0-release/contrib.gp.html) provides a framework for learning with Gaussian Processes. To get started, take a look at our [Gaussian Process Tutorial](http://pyro.ai/examples/gp.html). Thanks to Du Phan for this extensive contribution!

Automatic guide generation

Guides can now be created automatically with the [pyro.contrib.autoguide](http://pyro-ppl.readthedocs.io/en/0.2.0-release/contrib.autoguide.html) library. These work only for models with simple structure (no `irange` or `iarange`), and are easy to use:
python
from pyro.contrib.autoguide import AutoDiagNormal
def model(...):
...

guide = AutoDiagonalNormal(model)
svi = SVI(model, guide, ...)


Validation

Model validation is now available via three toggles:
python
pyro.enable_validation()
pyro.infer.enable_validation()
Turns on validation for PyTorch distributions.
pyro.distributions.enable_validation()

These can also be used temporarily as context managers
python
Run with validation in first step.
with pyro.validation_enabled(True):
svi.step()
Avoid validation on subsequent steps (may miss NAN errors).
with pyro.validation_enabled(False):
for i in range(1000):
svi.step()


Rejection sampling variational inference (RSVI)

We've added support for vectorized rejection sampling in a new `Rejector` distribution. See [docs](http://pyro-ppl.readthedocs.io/en/0.2.0-release/distributions.html#pyro.distributions.Rejector) or [`RejectionStandardGamma` class](https://github.com/uber/pyro/blob/0.4.0/pyro/distributions/testing/rejection_gamma.py#L12) for example usage.

0.4.0

This release drops support for Python 2. Additionally, it includes a few fixes to enable Pyro to use the latest PyTorch release, `version 1.2`.

**Some other additions / minor changes:**

- Add option for sequential predictions for MCMC [predictive](http://docs.pyro.ai/en/stable/mcmc.html#pyro.infer.mcmc.util.predictive).
- Move `pyro.contrib.autoguide` to the core Pyro repo.
- Additional inference algorithms
- [SMCFilter](http://docs.pyro.ai/en/stable/inference_algos.html#module-pyro.infer.smcfilter) for filtering via Sequential Monte Carlo
- Stein Variational Gradient Descent ([SVGD](http://docs.pyro.ai/en/stable/inference_algos.html#module-pyro.infer.smcfilter)).
- Add a [GaussianHMM](http://docs.pyro.ai/en/0.4.0/distributions.html#gaussianhmm) distribution for fast tuning of Gaussian state space models / Kalman filters

0.3.4

New features

- A more flexible [easyguide](http://docs.pyro.ai/en/stable/contrib.easyguide.html) module. Refer to the [tutorial](http://pyro.ai/examples/easyguide.html) for usage instructions.
- Different [initialization methods](http://docs.pyro.ai/en/stable/contrib.autoguide.html#module-pyro.contrib.autoguide.initialization) for autoguides.
- More [normalizing flows](http://docs.pyro.ai/en/stable/distributions.html#transformed-distributions) - Block Neural Autoregressive Flow, Sum of Squares, Sylvester Flow, DeepELUFlow, Householder Flow, RealNVP.
- Support [ReduceLROnPlateau](https://pytorch.org/docs/stable/optim.html#torch.optim.lr_scheduler.ReduceLROnPlateau) scheduler.
- New interface for MCMC inference:
- Ability to specify a potential function directly instead of Pyro model in HMC/NUTS [kernels](http://docs.pyro.ai/en/stable/mcmc.html#pyro.infer.mcmc.HMC).
- [MCMC.summary()](http://docs.pyro.ai/en/stable/mcmc.html#pyro.infer.mcmc.api.MCMC.summary) method that provides site level summary and diagnostic information.
- Utility function for [predictive](http://docs.pyro.ai/en/stable/mcmc.html#pyro.infer.mcmc.util.predictive) that replaces the `TracePredictive` class.
- Add divergence information to [MCMC.diagnostics()](http://docs.pyro.ai/en/stable/mcmc.html#pyro.infer.mcmc.api.MCMC.diagnostics).
- A [DiscreteHMM](http://docs.pyro.ai/en/stable/distributions.html#discretehmm) distribution for fast parallel training of discrete-state Hidden Markov Models with arbitrary observation distributions. See [examples/hmm.py](https://github.com/pyro-ppl/pyro/blob/0.3.4/examples/hmm.py#L491-L523) for example usage in a neural HMM.

Code changes and bug fixes

- Addresses pickling issue with Pyro handlers that makes it possible to pickle a much larger class of models.
- Multiple fixes for multiprocessing bugs with MCMC. With the new interface, the memory consumption is low thereby allowing for collecting many more samples.
- Performance enhancements for models with many sample sites.

0.3.3

Updates code for compatibility with PyTorch's latest release of version `1.1.0` - mostly function renaming, and using alternate tensor constructors in JIT to avoid `DeprecationWarning`.

0.3.2

New features

- A [capture-recapture example](http://pyro.ai/examples/capture_recapture.html) using stochastic variational inference.
- ELBO with trace adaptive f-divergence - `TraceTailAdaptive_ELBO`.
- New distribution classes - `LKJCorrCholesky`, `SpanningTree`.
- Distribution transforms - `RadialFlow`, `DeepSigmoidalFlow`, `BatchNormTransform`.
- Pareto-smoothed Importance Sampling (PSIS) diagnostic for Variational Inference.
- Vectorized indexing with [Vindex](http://docs.pyro.ai/en/stable/ops.html#module-pyro.ops.indexing). Refer to the [enumeration tutorial](http://pyro.ai/examples/enumeration.html) for more details on usage.
- `pyro.contrib.minipyro` now supports constrained parameters.
- `pyro.generic` module to support an API for backend-agnostic Pyro models. This makes it easier to switch between full Pyro and Minipyro. New backends like [funsor](https://github.com/pyro-ppl/funsor) and [numpyro](https://github.com/pyro-ppl/numpyro) are under active development.
- `pyro.contrib.conjugate` that provides utilities for exact inference on a small subset of conjugate models.

Code changes and bug fixes

- Optimized `Categorical.log_prob` so that evaluation on the distribution's support is much faster leading to almost 2X faster inference on models with enumerated discrete random variables.
- `pyro.module` ignores params with `requires_grad=False`.
- Correct shape inference in `MaskedDistribution` when run under `torch.jit.trace`.
- Fixed [infer_discrete](http://docs.pyro.ai/en/stable/inference_algos.html#pyro.infer.discrete.infer_discrete) to support plates of size 1 and variable dependencies across plate contexts.

0.3.1

Dependency changes

- Removes dependency on networkx.
- Uses opt_einsum version 2.3.2.

New features

- Conjugate probability distributions [BetaBinomial](http://docs.pyro.ai/en/0.3.1-release/distributions.html#pyro.distributions.BetaBinomial), [DirichletMultinomial](http://docs.pyro.ai/en/0.3.1-release/distributions.html#pyro.distributions.DirichletMultinomial), [GammaPoisson](http://docs.pyro.ai/en/0.3.1-release/distributions.html#pyro.distributions.GammaPoisson).
- The [VonMises](http://docs.pyro.ai/en/0.3.1-release/distributions.html#pyro.distributions.VonMises) distribution now supports sampling (thanks to ahmadsalim)
- A [second order HMM example](https://github.com/pyro-ppl/pyro/blob/dev/examples/hmm.py#L436).
- A [mixed-HMM example](https://github.com/pyro-ppl/pyro/tree/dev/examples/mixed_hmm) with seals data.

Minor changes and bug fixes

- Renamed `ubersum(..., batch_dims=...)` (deprecated) to `einsum(..., plates=...)`.
- HMC - fix bug in initial trace setter and diagnostics, resolve slowness issues during adaptation, expose `target_accept_prob` and `max_tree_depth` as arguments to the constructor to allow finer grained control over hyper-parameters.
- Many small fixes to the tutorials.

Page 5 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.