(pathfinder)=
:::{post} Feb 5, 2023 :tags: variational inference, JAX :category: advanced, how-to :author: Thomas Wiecki :::
Pathfinder {cite:p}zhang2021pathfinder is a variational inference algorithm that produces samples from the posterior of a Bayesian model. It compares favorably to the widely used ADVI algorithm. On large problems, it should scale better than most MCMC algorithms, including dynamic HMC (i.e. NUTS), at the cost of a more biased estimate of the posterior. For details on the algorithm, see the arxiv preprint.
PyMC's implementation of Pathfinder is now natively integrated using PyTensor. The Pathfinder implementation can be accessed through pymc-extras, which can be installed via:
pip install git+https://github.com/pymc-devs/pymc-extras
First, define your PyMC model. Here, we use the 8-schools model.
Next, we call pmx.fit() and pass in the algorithm we want it to use.
Just like pymc.sample(), this returns an idata with samples from the posterior. Note that because these samples do not come from an MCMC chain, convergence can not be assessed in the regular way.
:::{bibliography} :filter: docname in docnames :::
:::{include} ../page_footer.md :::