0.3.0
Breaking Changes
- HMC's find_heuristic_step_size (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
reparamhandler. See the eight schools example for the new usage pattern. - Automatic Guide Generation module is moved from
numpyro.contrib.autoguideto the main inference modulenumpyro.infer.autoguide. - Various API changes to match Pyro API:
- mask handler:
mask_arrayarg is renamed tomask. - scale handler:
scale_factorarg is renamed toscale. - condition and substitute handlers:
param_mapis renamed todata. MultivariateAffineTransformtransform is renamed to LowerCholeskyAffine.init_to_priorstrategy is renamed to init_to_sample.
- mask handler:
New Features
- Funsor-based NumPyro: allow enumeration over discrete latent variables. See mixture and Markov examples below for some applications.
- New primitives: plate_stack and scan. If your model has Python
forloop, considering usingscaninstead to improve compiling time. - New handlers: reparam, scope, and lift.
- New distributions: von Mises, Gumbel, Logistic, Laplace, TruncatedPolyaGamma, ExpandedDistribution, MaskedDistribution, and ImproperUniform.
- Distribution has new properties
is_discrete,has_enumerate_support, and new methods shape, enumerate_support, expand, expand_by, mask. In addition,Distributionhas been registered as a JAX Pytree class, with corresponding methodstree_flattenandtree_unflatten. - New constraint: less_than.
- Port Tensor Indexing from Pyro.
- Port some Reparameterizers from Pyro.
- Add
batch_ndimsarg to Predictive and log_likelihood to allow using those utilities with arbitrary number of batch dimensions.
New Examples
- Proportion Test example: 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: illustrates enumeration for mixture models.
- Enumerate HMM examples: illustrates enumeration for markov models.
- Bayesian Imputation tutorial.
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
platestatements. #555 - Fix KeyError with
scalehandler anddeterministicprimitive. #577 - Fix Poisson sampler entering into infinite loop under vmap. #582
- Fix the double compilation issue in
numpyro.optimclasses. #603 - Use ExpandedDistribution in
numpyro.plate. #616 - Timeseries forecasting tutorial is updated with
scanprimitive and the usage ofPredictivefor 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. #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!