Releases: pymc-devs/pymc
v4.1.0
What's Changed
Major Changes 🛠
- Dropped support for Python 3.7 and added support for Python 3.10 by @ricardoV94 in #5917
- Default to
pm.Data(mutable=False)by @michaelosthege in #5944 - Deprecating
MLDAin anticipation of migrating it topymc-experimentalby @michaelosthege in #5944
New Features & Bugfixes 🎉
- Small improvements to early NUTS behaviour by @aseyboldt in #5824
- Correct the order of
rvssent tocompile_dlogpinfind_MAPby @quantheory in #5928 - Remove
nan_is_numandnan_is_highlimiters fromfind_MAP. by @quantheory in #5929 - Registering
_as_tensor_variableconverter for pandas objects by @juanitorduz in #5920 - Fix
modelandaesara_configkwargs forpm.Modelby @ferrine in #5915
Docs & Maintenance 🔧
- Remove reference to old parameters in SMC docstring by @aloctavodia in #5914
- Get rid of python-version specific conda environments by @ricardoV94 in #5911
- Further fixes to VI docs by @ferrine in #5916
- Expand dimensionality notebook by @ricardoV94 in #5746
- Review docstrings checkmarcked as best practice by @OriolAbril in #5919
- Update conda environment name when running docker with jupyter notebook by @danhphan in #5933
- Update docs build and contributing instructions by @michaelosthege in #5938
- Add numpyro install to building docs instructions by @isms in #5936
- Add version string to conda install command. by @twiecki in #5946
New Contributors
- @quantheory made their first contribution in #5928
- @isms made their first contribution in #5936
Full Changelog: v4.0.1...v4.1.0
v4.0.1
What's Changed
Docs
- PyMC, Aesara and Aeppl intro notebook by @juanitorduz in #5721
- Moved wiki install guides to the docs by @fonnesbeck in #5869
- Fix Examples link in README by @ryanrussell in #5860
- Update dev guide by @michaelosthege in #5810
- Run black on core notebooks by @ricardoV94 in #5901
- Convert
rng_seedertorandom_seedin 'Prior and Posterior Predictive Checks' notebook by @hectormz in #5896 - Disable dark mode in docs by @ricardoV94 in #5904
- Fixed Student-t process docstring by @kunalghosh in #5853
Bugfixes & Maintenance
- Align advertised
Metropolis.stats_dtypeswith changes from 1e7d91f by @michaelosthege in #5882 - Added a check in
Empiricalapproximation which does not yet supportInferenceDatainputs (see #5884) by @ferrine in #5874 - Compute some basic
Slicesample stats by @ricardoV94 in #5889 - Fixed bug when sampling discrete variables with SMC by @ricardoV94 in #5887
- Removed
tsuffix from functions,Modelmethods and properties by @cuchoi in #5863Model.logpt→Model.logpModel.dlogpt→Model.dlogpModel.d2logpt→Model.d2logpModel.datalogpt→Model.datalogpModel.varlogpt→Model.varlogpModel.observedlogpt→Model.observedlogpModel.potentiallogpt→Model.potentiallogpModel.varlogp_nojact→Model.varlogp_nojaclogprob.joint_logpt→logprob.joint_logp
- Remove self-directing arrow in observed nodes by @larryshamalama in #5893
- Update
clone_replacestrictkeyword name by @brandonwillard in #5849 - Renamed
pm.Constanttopm.DiracDeltaby @cluhmann in #5903 - Update
Dockerfileto PyMC v4 by @danhphan in #5881 - Refactor
sampling_jaxpostrocessing to avoid jit by @ferrine in #5908 - Fix
compile_fnbug and reduce return type confusion by @michaelosthege in #5909 - Align conda envs and add Windows 3.9 env by @hectormz in #5895
- Include
ConstantDatainInferenceDatareturned by JAX samplers by @danhphan in #5807 - Updated Aesara dependency to 2.7.3 by @ricardoV94 in #5910
New Contributors
- @kunalghosh made their first contribution in #5853
- @ryanrussell made their first contribution in #5860
- @hectormz made their first contribution in #5896
Full Changelog: v4.0.0...v4.0.1
PyMC 4.0.0
If you want a description of the highlights of this release, check out the release announcement on our new website.
Feel free to read it, print it out, and give it to people on the street -- because everybody has to know PyMC 4.0 is officially out 🍾
Do not miss 🚨
⚠️ The project was renamed to "PyMC". Now the library is installed as "pip install pymc" and imported likeimport pymc as pm. See this migration guide for more details.⚠️ Theano-PyMC has been replaced with Aesara, so all external references totheanoandttneed to be replaced withaesaraandat, respectively (see 4471).⚠️ Support for JAX and JAX samplers, also allows sampling on GPUs. This benchmark shows speed-ups of up to 11x.⚠️ The GLM submodule was removed, please use Bambi instead.⚠️ PyMC now requires SciPy version>= 1.4.1(see #4857).
v3 features not yet working in v4 ⏳
- MvNormalRandomWalk, MvStudentTRandomWalk, GARCH11 and EulerMaruyama distributions (see #4642)
- Nested Mixture distributions (see #5533)
pm.sample_posterior_predictive_w(see #4807)- Partially observed Multivariate distributions (see #5260)
New features 🥳
-
Distributions:
-
Univariate censored distributions are now available via
pm.Censored. #5169 -
The
CARdistribution has been added to allow for use of conditional autoregressions which often are used in spatial and network models. -
Added a
logcdfimplementation for the Kumaraswamy distribution (see #4706). -
The
OrderedMultinomialdistribution has been added for use on ordinal data which are aggregated by trial, like multinomial observations, whereasOrderedLogisticonly accepts ordinal data in a disaggregated format, like categorical observations (see #4773). -
The
Polya-Gammadistribution has been added (see #4531). To make use of this distribution, thepolyagamma>=1.3.1library must be installed and available in the user's environment. -
pm.DensityDistcan now accept an optionallogcdfkeyword argument to pass in a function to compute the cummulative density function of the distribution (see 5026). -
pm.DensityDistcan now accept an optionalmomentkeyword argument to pass in a function to compute the moment of the distribution (see 5026). -
Added an alternative parametrization,
logit_ptopm.Binomialandpm.Categoricaldistributions (see 5637).
-
-
Model dimensions:
- The dimensionality of model variables can now be parametrized through either of
shapeordims(see #4696):- With
shapethe length of dimensions must be given numerically or as scalar AesaraVariables. Numeric entries inshaperestrict the model variable to the exact length and re-sizing is no longer possible. dimskeeps model variables re-sizeable (for example throughpm.Data) and leads to well defined coordinates inInferenceDataobjects.- An
Ellipsis(...) in the last position ofshapeordimscan be used as short-hand notation for implied dimensions.
- With
- New features for
pm.Datacontainers:- With
pm.Data(..., mutable=False), or by usingpm.ConstantData()one can now createTensorConstantdata variables. These can be more performant and compatible in situations where a variable doesn't need to be changed viapm.set_data(). See #5295. If you do need to change the variable, usepm.Data(..., mutable=True), orpm.MutableData(). - New named dimensions can be introduced to the model via
pm.Data(..., dims=...). For mutable data variables (see above) the lengths of these dimensions are symbolic, so they can be re-sized viapm.set_data(). pm.Datanow passes additional kwargs toaesara.shared/at.as_tensor. #5098.
- With
- The length of
dimsin the model is now tracked symbolically throughModel.dim_lengths(see #4625).
- The dimensionality of model variables can now be parametrized through either of
-
Sampling:
⚠️ Random seeding behavior changed (see #5787)!- Sampling results will differ from those of v3 when passing the same
random_seedas before. They will be consistent across subsequent v4 releases unless mentioned otherwise. - Sampling functions no longer respect user-specified global seeding! Always pass
random_seedto ensure reproducible behavior. random_seednow accepts RandomState and Generators besides integers.
- Sampling results will differ from those of v3 when passing the same
- A small change to the mass matrix tuning methods jitter+adapt_diag (the default) and adapt_diag improves performance early on during tuning for some models. #5004
- New experimental mass matrix tuning method jitter+adapt_diag_grad. #5004
- Support for samplers written in JAX:
- Adding support for numpyro's NUTS sampler via
pymc.sampling_jax.sample_numpyro_nuts() - Adding support for blackjax's NUTS sampler via
pymc.sampling_jax.sample_blackjax_nuts()(see #5477) pymc.sampling_jaxsamplers supportlog_likelihood,observed_data, andsample_statsin returnedInferenceDataobject (see #5189)- Adding support for
pm.Deterministicinpymc.sampling_jax(see #5182)
- Adding support for numpyro's NUTS sampler via
-
Miscellaneous:
- The new
pm.find_constrained_priorfunction can be used to find optimized prior parameters of a distribution under some
constraints (e.g lower and upper bound). See #5231. - Nested models now inherit the parent model's coordinates. #5344
softmaxandlog_softmaxfunctions added tomathmodule (see #5279).- Added the low level
compile_forward_sampling_functionmethod to compile the aesara function responsible for generating forward samples (see #5759).
- The new
Expected breaking changes 💔
pm.sample(return_inferencedata=True)is now the default (see #4744).- ArviZ
plotsandstatswrappers were removed. The functions are now just available by their original names (see #4549 and3.11.2release notes). pm.sample_posterior_predictive(vars=...)kwarg was removed in favor ofvar_names(see #4343).ElemwiseCategoricalstep method was removed (see #4701)LKJCholeskyCov'scompute_corrkeyword argument is now set toTrueby default (see#5382)- Alternative
sdkeyword argument has been removed from all distributions.sigmashould be used instead (see #5583).
Read on if you're a developer. Or curious. Or both.
Unexpected breaking changes (action needed) 😲
Very important ⚠️
pm.Boundinterface no longer accepts a callable class as argument, instead it requires an instantiated distribution (created via the.dist()API) to be passed as an argument. In addition, Bound no longer returns a class instance but works as a normal PyMC distribution. Finally, it is no longer possible to do predictive random sampling from Bounded variables. Please, consult the new documentation for details on how to use Bounded variables (see 4815).- BART has received various updates (5091, 5177, 5229, 4914) but was removed from the main package in #5566. It is now available from pymc-experimental.
- Removed
AR1.ARof order 1 should be used instead. (see 5734). - The
pm.EllipticalSlicesampler was removed (see #5756). BaseStochasticGradientwas removed (see #5630)pm.Distribution(...).logp(x)is nowpm.logp(pm.Distribution(...), x).pm.Distribution(...).logcdf(x)is nowpm.logcdf(pm.Distribution(...), x).pm.Distribution(...).random(size=x)is nowpm.draw(pm.Distribution(...), draws=x).pm.draw_values(...)and `pm.genera...
4.0.0 beta 6
What's Changed
- Implemented default transform for Mixtures by @ricardoV94 in #5636
- Scope separator for netcdf by @ferrine in #5663
- Fix default update bug by @ricardoV94 in #5667
- Pandas dependency was removed by @thomasjpfan in #5633
- Recognize cast data in InferenceData by @zaxtax in #5646
- Updated docstrings of multiple distributions by @purna135 in #5595, #5596 and #5600
- Refine Interval docstrings and fix typo by @ricardoV94 in #5640
- Add test for interactions between missing, default and explicit updates in
compile_pymcby @ricardoV94 in #5645 - Test reshape from observed by @ricardoV94 in #5670
- Upgraded all CI cache actions to v3 by @michaelosthege in #5647
Full Changelog: v4.0.0b5...v4.0.0b6
4.0.0 beta 5
What's Changed
- Generalize multinomial moment to arbitrary dimensions by @markvrma in #5476
- Remove sd optional kwarg from distributions by @purna135 in #5583
- Improve scoped models by @ferrine in #5607
- Add helper wrapper aound Interval transform by @ricardoV94 in #5347
- Rename
logp_transformto_get_default_transformby @ricardoV94 in #5612 - Do not set RNG updates inplace in compile_pymc by @ricardoV94 in #5615
- Refine trigger filter for both PRs and pushes by @michaelosthege in #5619
- Update contributing guide with etiquette section by @michaelosthege in #5611
- Combine test workflows into one by @michaelosthege in #5623
- Raise ValueError if random variables are present in the logp graph by @ricardoV94 in #5614
- Run float32 jobs separately by @michaelosthege in #5630
- Bring back sampler argument target_accept by @aloctavodia in #5622
- Parametrize Binomial and Categorical distributions via logit_p by @purna135 in #5637
- Remove SGMCMC and fix flaky mypy results by @michaelosthege in #5631
Full Changelog: v4.0.0b4...v4.0.0b5
v4.0.0 beta 4
This release adds the following major improvements:
- Refactor Mixture distribution for V4 by @ricardoV94 in #5438
- Adding NUTS sampler from blackjax to sampling_jax by @zaxtax in #5477
- Update aesara and aeppl dependencies to fix a memory leak in pymc models by @ricardoV94 in #5582
New Contributors
- @mirko-m made their first contribution in #5414
- @chritter made their first contribution in #5491
- @5hv5hvnk made their first contribution in #5601
Full Changelog: v4.0.0b3...v4.0.0b4
PyMC 3.11.5
PyMC 3.11.5 (15 March 2022)
This is a backport & bugfix release that eases the transition to pymc >=4.0.0.
Backports
- The
pm.logp(rv, x)syntax is now available and recommended to make your model codev4-ready. Note that this backport is just an alias and much less capable than what's available withpymc >=4(see #5083). - The
pm.Distribution(testval=...)kwarg was deprecated and will be replaced bypm.Distribution(initval=...)inpymc >=4(see #5226). - The
pm.sample(start=...)kwarg was deprecated and will be replaced bypm.sample(initvals=...)inpymc >=4(see #5226). pm.LogNormalis now available as an alias forpm.Lognormal(see #5389).
Bugfixes
PyMC 4.0.0 beta 3
Here is the full list of changes compared to 4.0.0b2.
For a current list of changes w.r.t. the upcoming v3.11.5 see RELEASE-NOTES.md.
Notable changes & features
- ADVI has been ported to PyMC 4
- LKJ has been ported to PyMC 4 (#5382)
- Dependencies have been updated
v4.0.0b2
PyMC 4.0.0 beta 2
This beta release includes the removal of warnings, polishing of APIs, more distributions and internal refactorings.
Here is the full list of changes compared to 4.0.0b1.
For a current list of changes w.r.t. the upcoming v3.11.5 see RELEASE-NOTES.md.
Notable changes & features
- Introduction of
pm.Data(..., mutable=False/True)and correspondingpm.ConstantData/pm.MutableDatawrappers (see #5295). - The warning about
theanoorpymc3being installed in parallel was removed. dimscan again be specified alongsideshapeorsize(see #5325).pm.drawwas added to draw prior samples from a variable (see #5340).- Renames of model properties & methods like
Model.logpt. - A function to find a prior based on lower/upper bounds (see #5231).
v4.0.0b1
PyMC 4.0.0 beta 1
⚠ This is the first beta of the next major release for PyMC 4.0.0 (formerly PyMC3). 4.0.0 is a rewrite of large parts of the PyMC code base which make it faster, adds many new features, and introduces some breaking changes. For the most part, the API remains stable and we expect that most models will work without any changes.
Not-yet working features
We plan to get these working again, but at this point, their inner workings have not been refactored.
- Timeseries distributions (see #4642)
- Mixture distributions (see #4781)
- Cholesky distributions (see WIP PR #4784)
- Variational inference submodule (see WIP PR #4582)
- Elliptical slice sampling (see #5137)
BaseStochasticGradient(see #5138)pm.sample_posterior_predictive_w(see #4807)- Partially observed Multivariate distributions (see #5260)
Also, check out the milestones for a potentially more complete list.
Unexpected breaking changes (action needed)
- New API is not available in
v3.11.5. - Old API does not work in
v4.0.0.
All of the above applies to:
- ⚠ The library is now named, installed, and imported as "pymc". For example:
pip install pymc. (Usepip install pymc --prewhile we are in the pre-release phase.) - ⚠ Theano-PyMC has been replaced with Aesara, so all external references to
theano,tt, andpymc3.theanofneed to be replaced withaesara,at, andpymc.aesaraf(see 4471). pm.Distribution(...).logp(x)is nowpm.logp(pm.Distribution(...), x)pm.Distribution(...).logcdf(x)is nowpm.logcdf(pm.Distribution(...), x)pm.Distribution(...).random()is nowpm.Distribution(...).eval()pm.draw_values(...)andpm.generate_samples(...)were removed. The tensors can now be evaluated with.eval().pm.fast_sample_posterior_predictivewas removed.pm.sample_prior_predictive,pm.sample_posterior_predictiveandpm.sample_posterior_predictive_wnow return anInferenceDataobject by default, instead of a dictionary (see #5073).pm.sample_prior_predictiveno longer returns transformed variable values by default. Pass them by name invar_namesif you want to obtain these draws (see 4769).pm.sample(trace=...)no longer acceptsMultiTraceorlen(.) > 0traces (see 5019#).- The GLM submodule was removed, please use Bambi instead.
pm.Boundinterface no longer accepts a callable class as an argument, instead, it requires an instantiated distribution (created via the.dist()API) to be passed as an argument. In addition, Bound no longer returns a class instance but works as a normal PyMC distribution. Finally, it is no longer possible to do predictive random sampling from Bounded variables. Please, consult the new documentation for details on how to use Bounded variables (see 4815).pm.logpt(transformed=...)kwarg was removed (816b5f).Model(model=...)kwarg was removedModel(theano_config=...)kwarg was removedModel.sizeproperty was removed (useModel.ndiminstead).dimsandcoordshandling:Model.update_start_values(...)was removed. Initial values can be set in theModel.initial_valuesdictionary directly.- Test values can no longer be set through
pm.Distribution(testval=...)and must be assigned manually. Transform.forwardandTransform.backwardsignatures changed.pm.DensityDistno longer accepts thelogpas its first positional argument. It is now an optional keyword argument. If you pass a callable as the first positional argument, aTypeErrorwill be raised (see 5026).pm.DensityDistnow accepts distribution parameters as positional arguments. Passing them as a dictionary in theobservedkeyword argument is no longer supported and will raise an error (see 5026).- The signature of the
logpandrandomfunctions that can be passed into apm.DensityDisthas been changed (see 5026). - Changes to the Gaussian process (
gp) submodule:- The
gp.prior(..., shape=...)kwarg was renamed tosize. - Multiple methods including
gp.priornow require explicit kwargs.
- The
- Changes to the BART implementation:
- Changes to the Gaussian Process (GP) submodule (see 5055):
- For all implementations,
gp.Latent,gp.Marginaletc.,cov_funcandmean_funcare required kwargs. - In Windows test conda environment the
mklversion is fixed to verison 2020.4, andmkl-serviceis fixed to2.3.0. This was required forgp.MarginalKronto function properly. gp.MvStudentTuses rotated samples fromStudentTdirectly now, instead of sampling frompm.Chi2and then frompm.Normal.- The "jitter" parameter, or the diagonal noise term added to Gram matrices such that the Cholesky is numerically stable, is now exposed to the user instead of hard-coded. See the function
gp.util.stabilize. - The
is_observedargument forgp.Marginal*implementations has been deprecated. - In the gp.utils file, the
kmeans_inducing_pointsfunction now passes throughkmeans_kwargsto scipy's k-means function. - The function
replace_with_valuesfunction has been added togp.utils. MarginalSparsehas been renamedMarginalApprox.
- For all implementations,
Expected breaks
- New API was already available in
v3. - Old API had deprecation warnings since at least
3.11.0(2021-01). - Old API stops working in
v4(preferably with informative errors).
All of the above apply to:
pm.sample(return_inferencedata=True)is now the default (see #4744).- ArviZ
plotsandstatswrappers were removed. The functions are now just available by their original names (see #4549 and3.11.2release notes). pm.sample_posterior_predictive(vars=...)kwarg was removed in favor ofvar_names(see #4343).ElemwiseCategoricalstep method was removed (see #4701)
Ongoing deprecations
- Old API still works in
v4and has a deprecation warning. - Preferably the new API should be available in
v3already
New features
- The length of
dimsin the model is now tracked symbolically throughModel.dim_lengths(see #4625). - The
CARdistribution has been added to allow for use of conditional autoregressions which often are used in spatial and network models. - The dimensionality of model variables can now be parametrized through either of
shape,dimsorsize(see #4696):- With
shapethe length of dimensions must be given numerically or as scalar AesaraVariables. Numeric entries inshaperestrict the model variable to the exact length and re-sizing is no longer possible. dimskeeps model variables re-sizeable (for example throughpm.Data) and leads to well-defined coordinates inInferenceDataobjects.- The
sizekwarg behaves as it does in Aesara/NumPy. For univariate RVs it is the same asshape, but for multivariate RVs it depends on how the RV implements broadcasting to dimensionality greater thanRVOp.ndim_supp. - An
Ellipsis(...) in the last position ofshapeordimscan be used as shorthand notation for implied dimensions.
- With
- Added a
logcdfimplementation for the Kumaraswamy distribution (see #4706). - The
OrderedMultinomialdistribution has been added for use on ordinal data which are aggregated by trial, like multinomial observations, whereasOrderedLogisticonly accepts ordinal data in a disaggregated format, like categorical
observations (see #4773). - The
Polya-Gammadistribution has been added (see #4531). To make use of this distribution, thepolyagamma>=1.3.1library must be installed and available in the user's environment. - A small change to the mass matrix tuning methods jitter+adapt_diag (the default) and adapt_diag improves performance early on during tuning for some models. #5004
- New experimental mass matrix tuning method jitter+adapt_diag_grad. [#5004](https://github.com/pymc-devs/pymc/pu...