Breaking changes
:warning: **This release changes the high-level API as well as import paths** :warning:
This release simplifies the high-level API for samplers. For instance, to initialize and use a HMC kernel:
python
import blackjax
hmc = blackjax.hmc(logprob_fn step_size, inverse_mass_matrix, num_integration_steps)
state = hmc.init(position)
new_state, info = hmc.step(rng_key, state)
`hmc` is now a namedtuple with a `init` and a `step` function; you only need to pass `logprob_fn` at initialization unlike the previous version. The internals were simplified a lot, and the hierarchy is now more flat. For instance, to use the base HMC kernel directly:
python
import blackjax.mcmc.integrators as integrators
import blackjax.mcmc.hmc as hmc
kernel = hmc.kernel(integrators.mclachlan)
state = hmc.init(position, logprob_fn)
state, info = kernel(rng_key, state, logprob_fn, step_size, inverse_mass_matrix, num_integration_steps)
The API of the base kernels has also been changed to be more flexible.
Performance improvements
Thanks to the work of zaxtax junpenglao and rlouf the performance of the NUTS sampler (especially the warmup) has been greatly improved and is now at least on par with numpyro.
What's Changed
No new algorithm in this release, but important work was done on the API, the internals and the examples.
* Fix SMC notebook as per issue https://github.com/blackjax-devs/blackjax/issues/148 by AdrienCorenflos in https://github.com/blackjax-devs/blackjax/pull/149
* Add a logistic regression example by gerdm in https://github.com/blackjax-devs/blackjax/pull/103
* Update to fold in all trajectory building into a single while_loop by junpenglao in https://github.com/blackjax-devs/blackjax/pull/164
* Update use_with_numpyro.ipynb by junpenglao in https://github.com/blackjax-devs/blackjax/pull/165
* Updated trajectory.py by Gautam-Hegde in https://github.com/blackjax-devs/blackjax/pull/167
* Simplify the user API & create a more general kernel by rlouf in https://github.com/blackjax-devs/blackjax/pull/159
* Make the PyMC example run on version 4 by rlouf in https://github.com/blackjax-devs/blackjax/pull/178
* Moved dual_averaging.py to /adaptation and renamed it to optimizers.py by Bnux256 in https://github.com/blackjax-devs/blackjax/pull/179
* Fix example notebook to use pymc 4 by zaxtax in https://github.com/blackjax-devs/blackjax/pull/180
New Contributors
* gerdm made their first contribution in https://github.com/blackjax-devs/blackjax/pull/103
* Gautam-Hegde made their first contribution in https://github.com/blackjax-devs/blackjax/pull/167
* Bnux256 made their first contribution in https://github.com/blackjax-devs/blackjax/pull/179
* zaxtax made their first contribution in https://github.com/blackjax-devs/blackjax/pull/180
**Full Changelog**: https://github.com/blackjax-devs/blackjax/compare/0.3.0...0.4.0