LittleMCMC — A Standalone HMC and NUTS Sampler in Python

Hi all,

For the last few months I’ve been working on isolating PyMC3’s HMC and NUTS samplers into a lightweight, standalone library - littlemcmc - and it’s just about ready for users!

I gave more context in my blog post, but it’s short enough for me to reproduce here:

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, @junpenglao 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.

Please check it out!


10 Likes