Numpyro

Latest version: v0.15.0

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

Scan your dependencies

Page 4 of 5

0.5.0

New documentation page with galleries of tutorials and examples [num.pyro.ai](num.pyro.ai).

New Features

- New primitive: [prng_key](http://num.pyro.ai/en/latest/primitives.html#prng-key) to draw a random key under `seed` handler.
- New autoguide: [AutoDelta](http://num.pyro.ai/en/latest/autoguide.html#autodelta)
- New samplers:
- [HMCGibbs](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc_gibbs.HMCGibbs): a general HMC/NUTS-within-Gibbs interface.
- [DiscreteHMCGibbs](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc_gibbs.DiscreteHMCGibbs): HMC/NUTS-within-Gibbs for models with discrete latent variables.
- [HMCECS](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc_gibbs.HMCECS): HMC/NUTS with energy conserving subsampling.
- New example:
- [CJS capture-recapture model for ecological data](http://num.pyro.ai/en/latest/examples/capture_recapture.html)
- New kernels module in `numpyro.contrib.einstein`, in preparing for (Ein)Stein VI inference in future releases.
- New user-friendly [SVI.run](http://num.pyro.ai/en/latest/svi.html#numpyro.infer.svi.SVI.run) method to simplify the training phase of SVI inference.
- New [feasible_like](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.constraints.Constraint.feasible_like) method in constraints.
- New methods `forward_shape` and `inverse_shape` in [Transform](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.transforms.Transform.forward_shape) to infer output shape given input shape.
- [Transform.inv](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.transforms.Transform.inv) now returns an inversed transform, hence enables many new (inversed) transforms.
- Support [thinning](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.mcmc.MCMC) in MCMC.
- Add [post_warmup_state](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.mcmc.MCMC.post_warmup_state) and [last_state](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.mcmc.MCMC.last_state) to allow sequential sampling strategy in MCMC: allow to keep calling `.run` method to get more samples.
- New `history` argument to support for Markov models with `history > 1` in [scan](http://num.pyro.ai/en/latest/primitives.html#scan).
- New [forward_model_differentiation](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc.NUTS) argument in HMC/NUTS kernels to allow to use forward mode differentiation.

Enhancements and Bug Fixes

- 886 Make TransformReparam compatible with `.to_event()`
- 883 Improve gradient computation of Euclidean kinetic energy.
- 872 Enhance masked distribution to allow gradient propagate properly when using `mask` handler for invalid data.
- 865 Make subsample faster in CPU.
- 860 Fix for memory leak in MCMC.
- 849 Expose `logits` attribute to some discrete distributions
- 848 Add `has_rsample` and `rsample` attribute to distributions
- 832 Allow a callable to return an init value in `param` primitive
- 824 Fix for cannot using sample method of TFP distributions in `sample` primitive.
- 823 Demo on how to use various init strategies in Gaussian Process example.
- 822 Allow haiku/flax modules to take general args/kwargs in `init`.
- 821 Better error messages when `rng_key` is missing.
- 818 Better error messages when an error happens in the middle of inference.
- 805 Display correct progress bar message after running `MCMC.warmup`.
- 801 Raise an error early if missing plates for models with discrete latent variables.
- 797 MCMC `vectorized` chain method works for models with deterministic sites.
- 796 Bernoulli distribution returns an int instead of a boolean.
- 795 Reveal signature for `help(Distribution)`.

Thanks Ola Ronning OlaRonning, Armin Stepanjan ab-10, cerbelaut, Xi Wang xidulu, Wouter van Amsterdam vanAmsterdam, loopylangur, and many others for your contributions and helpful feedback!

0.4.1

New Features

- 772 Add [DirichletMultinomial](http://num.pyro.ai/en/latest/distributions.html#dirichletmultinomial) distribution.
- 773 (experiment) Add [collapse](http://num.pyro.ai/en/latest/handlers.html#collapse) handler to exploit conjugacy relations.

Enhancements and Bug Fixes

- 764 Make exception chaining more user-friendly. Thanks, akihironitta!
- 766 Relax [interval](http://num.pyro.ai/en/stable/distributions.html#interval) constraint.
- 776 Fix bugs in methods `log_prob` and `sample` of `VonMises` distribution.
- 775 Make validation mechanism compatible with [omnistaging](https://github.com/google/jax/blob/master/design_notes/omnistaging.md) since JAX 0.2.
- 780 Fix name dimensions of sample sites under `contrib.funsor`'s `plate` handler.

0.4.0

Experimental integrations with JAX-based [TensorFlow Probability](https://github.com/tensorflow/probability/) and neural network libraries [Flax](https://github.com/google/flax) and [Haiku](https://github.com/deepmind/dm-haiku). New high-quality tutorials written by NumPyro contributors. JAX 0.2 enables "omnistaging" by default (see [this guide](https://github.com/google/jax/blob/master/design_notes/omnistaging.md) for what omnistaging means and how to update your code if it is broken after the upgrade - you can also disable this new behavior with `jax.config.disable_omnistaging()`).

New Features

- New primitives in `numpyro.contrib.module` to create Bayesian Neural Networks (BNN) using [Flax](https://github.com/google/flax) or [Haiku](https://github.com/deepmind/dm-haiku): [flax_module](http://num.pyro.ai/en/latest/primitives.html#flax-module), [random_flax_module](http://num.pyro.ai/en/latest/primitives.html#random-flax-module), [haiku_module](http://num.pyro.ai/en/latest/primitives.html#haiku-module), [random_haiku_module](http://num.pyro.ai/en/latest/primitives.html#random-haiku-module). See [random_flax_module](http://num.pyro.ai/en/latest/primitives.html#random-flax-module) doc for an end-to-end example to construct, train, and make prediction with a BNN.
- Wrappers for many [TensorFlow Probability distributions](http://num.pyro.ai/en/latest/distributions.html#tensorflow-distributions) in `numpyro.contrib.tfp.distributions`.
- Wrappers for many [TensorFlow MCMC kernels](http://num.pyro.ai/en/latest/mcmc.html#tensorflow-kernels) in `numpyro.contrib.tfp.mcmc`. A user-defined TensorFlow MCMC kernel can be converted to NumPyro-compatible one using [TFPKernel](http://num.pyro.ai/en/latest/mcmc.html#tfpkernel).
- New distribution: [Geometric](http://num.pyro.ai/en/latest/distributions.html#geometric) distribution.
- New primitive: [subsample](http://num.pyro.ai/en/latest/primitives.html#subsample) primitive for data/param subsampling.
- New auto guide: [AutoNormal](http://num.pyro.ai/en/latest/autoguide.html#autonormal) which is similar to `AutoDiagonalNormal` but more suitable for mean field ELBO and param subsampling.
- New SVI objective: [TraceMeanField_ELBO](http://num.pyro.ai/en/latest/svi.html#numpyro.infer.elbo.ELBO).
- New optimizer: [Minimize](http://num.pyro.ai/en/latest/optimizers.html#minimize) with BFGS method.

New Examples

- [Bayesian Imputation for Missing Values in Discrete Covariates](https://github.com/pyro-ppl/numpyro/blob/master/notebooks/source/discrete_imputation.ipynb) tutorial: leverage enumeration mechanism to marginalize discrete missing covariates - applied for clinical synthesis data.
- [Bayesian Hierarchical Linear Regression](https://github.com/pyro-ppl/numpyro/blob/master/notebooks/source/bayesian_hierarchical_linear_regression.ipynb) tutorial: practical Bayesian inference for Kaggle competitions.
- [Ordinal Regression](https://github.com/pyro-ppl/numpyro/blob/master/notebooks/source/ordinal_regression.ipynb) tutorial: how to deal with ordered discrete data.

Deprecation

Changes to match Pyro api.

- `ELBO` objective is renamed to `Trace_ELBO`.
- `value` argument in `Delta` distribution is replaced by `v`.
- `init_strategy` argument in autoguides is replaced by `init_loc_fn`.

Enhancements and Bug Fixes

- Relax `simplex` constraint. 725 737
- Fix `init_strategy` argument not respected in HMC and SA kernels. 728
- Validate the model when cannot find valid initial params. 733
- Avoid `nan` acceptance probability in SA kernel. 740

Thanks xidulu, vanAmsterdam, TuanNguyen27, ucals, elchorro, RaulPL, and many others for your contributions and helpful feedback!

0.3.0

Breaking Changes

- HMC's [find_heuristic_step_size](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.hmc.HMC) (this functionality is different from step size adaptation scheme) is disabled by default to improve compiling time. Previous behavior can be enabled by setting `find_heuristic_step_size=True`.
- The automatic reparameterization mechanism introduced in NumPyro 0.2 is removed, in favor of `reparam` handler. See [the eight schools example](https://github.com/pyro-ppl/numpyro/#a-simple-example---8-schools) for the new usage pattern.
- [Automatic Guide Generation](http://num.pyro.ai/en/latest/autoguide.html) module is moved from `numpyro.contrib.autoguide` to the main inference module `numpyro.infer.autoguide`.
- Various API changes to match Pyro API:
+ [mask](http://num.pyro.ai/en/latest/handlers.html#mask) handler: `mask_array` arg is renamed to `mask`.
+ [scale](http://num.pyro.ai/en/latest/handlers.html#scale) handler: `scale_factor` arg is renamed to `scale`.
+ [condition](http://num.pyro.ai/en/latest/handlers.html#condition) and [substitute](http://num.pyro.ai/en/latest/handlers.html#substitute) handlers: `param_map` is renamed to `data`.
+ `MultivariateAffineTransform` transform is renamed to [LowerCholeskyAffine](http://num.pyro.ai/en/latest/distributions.html#lowercholeskyaffine).
+ `init_to_prior` strategy is renamed to [init_to_sample](http://num.pyro.ai/en/latest/utilities.html#init-to-sample).

New Features

- [Funsor-based NumPyro](http://num.pyro.ai/en/latest/funsor.html): allow enumeration over discrete latent variables. See mixture and Markov examples below for some applications.
- New primitives: [plate_stack](http://num.pyro.ai/en/latest/primitives.html#numpyro.primitives.plate_stack) and [scan](http://num.pyro.ai/en/latest/primitives.html#numpyro.contrib.control_flow.scan). If your model has Python `for` loop, considering using `scan` instead to improve compiling time.
- New handlers: [reparam](http://num.pyro.ai/en/latest/handlers.html#reparam), [scope](http://num.pyro.ai/en/latest/handlers.html#scope), and [lift](http://num.pyro.ai/en/latest/handlers.html#lift).
- New distributions: [von Mises](http://num.pyro.ai/en/latest/distributions.html#vonmises), [Gumbel](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.continuous.Gumbel), [Logistic](http://num.pyro.ai/en/latest/distributions.html#logistic), [Laplace](http://num.pyro.ai/en/latest/distributions.html#laplace), [TruncatedPolyaGamma](http://num.pyro.ai/en/latest/distributions.html#truncatedpolyagamma), [ExpandedDistribution](http://num.pyro.ai/en/latest/distributions.html#expandeddistribution), [MaskedDistribution](http://num.pyro.ai/en/latest/distributions.html#maskeddistribution), and [ImproperUniform](http://num.pyro.ai/en/latest/distributions.html#improperuniform).
- [Distribution](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution) has new properties `is_discrete`, `has_enumerate_support`, and new methods [shape](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution.shape), [enumerate_support](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution.enumerate_support), [expand](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution.expand), [expand_by](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution.expand_by), [mask](http://num.pyro.ai/en/latest/distributions.html#numpyro.distributions.distribution.Distribution.mask). In addition, `Distribution` has been registered as [a JAX Pytree](https://jax.readthedocs.io/en/latest/pytrees.html) class, with corresponding methods `tree_flatten` and `tree_unflatten`.
- New constraint: [less_than](http://num.pyro.ai/en/latest/distributions.html#less-than).
- Port [Tensor Indexing](http://num.pyro.ai/en/latest/utilities.html#module-numpyro.contrib.indexing) from Pyro.
- Port some [Reparameterizers](http://num.pyro.ai/en/latest/reparam.html) from Pyro.
- Add `batch_ndims` arg to [Predictive](http://num.pyro.ai/en/latest/utilities.html#numpyro.infer.util.Predictive) and [log_likelihood](http://num.pyro.ai/en/latest/utilities.html#numpyro.infer.util.log_likelihood) to allow using those utilities with arbitrary number of batch dimensions.

New Examples

- [Proportion Test example](http://pyro.ai/numpyro/examples/proportion_test.html): You are managing a business and want to test if calling your customers will increase their chance of making a purchase.
- [Bayesian Models of Annotation examples](http://pyro.ai/numpyro/examples/annotation.html): illustrates enumeration for mixture models.
- [Enumerate HMM examples](http://pyro.ai/numpyro/examples/hmm_enum.html): illustrates enumeration for markov models.
- [Bayesian Imputation tutorial](http://pyro.ai/numpyro/bayesian_imputation.html).

Enhancements and Bug Fixes

- HMC/NUTS compiling time is greatly improved, especially for large models.
- More efficient BTRS algorithm for sampling from Binomial distribution. 537
- Allow arbitrary order of `plate` statements. 555
- Fix KeyError with `scale` handler and `deterministic` primitive. 577
- Fix Poisson sampler entering into infinite loop under vmap. 582
- Fix the double compilation issue in `numpyro.optim` classes. 603
- Use ExpandedDistribution in `numpyro.plate`. 616
- [Timeseries forecasting tutorial](http://pyro.ai/numpyro/time_series_forecasting.html) is updated with `scan` primitive and the usage of `Predictive` for forecasting. #608 657
- Tweak sparse regression example to bring the model into exact alignment with the reference. 669
- Add MetropolisHastings algorithm as an example of [MCMCKernel](http://num.pyro.ai/en/stable/mcmc.html#numpyro.infer.mcmc.MCMCKernel). 680


Thanks Nikolaos daydreamt, Daniel Sheldon dsheldon, Lukas Prediger lumip, Freddy Boulton freddyaboulton, Wouter van Amsterdam vanAmsterdam, and many others for their contributions and helpful feedback!

0.2.4

New Features

- NumPyro can be used on Cloud TPUs.
- [Deterministic](http://num.pyro.ai/en/latest/primitives.html#deterministic) primitive to record deterministic values in a model.
- [Mask](http://num.pyro.ai/en/latest/handlers.html#mask) handler to mask out the log probability of a sample site using a mask array.
- [Sample Adaptive MCMC](http://num.pyro.ai/en/latest/mcmc.html#numpyro.infer.mcmc.SA), a non-gradient based sampler that has a high effective sample size per second.
- New normalizing flow: [Block neural autoregressive transform](http://num.pyro.ai/en/latest/distributions.html#blockneuralautoregressivetransform).
- Additional auto guides: [AutoLowRankMultivariateNormal](http://num.pyro.ai/en/latest/autoguide.html#autolowrankmultivariatenormal) and [AutoBNAFNormal](http://num.pyro.ai/en/latest/autoguide.html#autobnafnormal).

New Examples

- [Predator-prey model example](https://github.com/pyro-ppl/numpyro/blob/master/examples/ode.py): uses MCMC to solve the inverse problem of an ODE system.
- [Neural transport example](https://github.com/pyro-ppl/numpyro/blob/master/examples/neutra.py): uses a normalizing flow to transform the posterior to a Gaussian-like one, thereby improving mixing rate for HMC/NUTS.

Deprecation / Breaking Changes

- Predictive's [get_samples](http://num.pyro.ai/en/latest/utilities.html#numpyro.infer.util.Predictive.get_samples) method is deprecated in favor of `__call__` method.
- MCMC `constrain_fn` is renamed to `postprocess_fn`.

Enhancements and Bug Fixes

- Change the init scale of Auto\*Normal guides from 1. to 0.1 - this is helpful for stability during the early training phase.
- Resolve overflow issue with the Poisson sampler.

0.2.3

Patches `0.2.2` with the following changes:
- restore compatibility with python 3.7 for `mcmc`.
- impose cache size limit in MCMC utilities.

Page 4 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.