⁂ George Ho

littlemcmc — A Standalone HMC and NUTS Sampler in Python

LittleMCMC logo

Recently there has been a modularization (or, if you’re hip with tech-lingo, an unbundling) of Bayesian modelling libraries. Whereas before, probability distributions, model specification, inference and diagnostics were more or less rolled into one library, it’s becoming more and more realistic to specify a model in one library, accelerate it using another, perform inference with a third and use a fourth to visualize the results. (For example, Junpeng Lao has recently had good success doing exactly this!)

It’s in this spirit of unbundling that the PyMC developers wanted to spin out the core HMC and NUTS samplers from PyMC3 into a separate library. PyMC3 has a very well-tested and performant Python implementation of HMC and NUTS, which would be very useful to any users who have their own functions for computing log-probability and its gradients, and who want to use a lightweight and reliable sampler.

So for example, if you’re a physical scientist with a Bayesian model who’s written your own functions to compute the log probability and its gradients (perhaps for performance or interoperability reasons), and need a good MCMC sampler, then littlemcmc is for you! As long as you can call your functions from Python, you can use the same HMC or NUTS sampler that’s used by the rest of the PyMC3 community.

So without further ado: please check out littlemcmc!

#bayes #open-source #probabilistic-programming #pymc #python