Pages

Wednesday, December 23, 2015

Hamiltonian Monte Carlo with Stan

Stan is a library for doing Bayesian statistical inference. One of the really cool capabilities it has is the Hamiltonian Monte Carlo (HMC) method rather than the more common Markov Chain approaches. There are interfaces for using the library from Python, R or the command line:

Stan is based on a probabilistic programming language for specifying models in terms of probability distributions. Stan’s modeling language is is portable across all interfaces (PyStan, RStan, CmdStan).

I found this video from the documentation page a very understandable description of the Hamiltonian Monte Carlo approach used by Stan. It's neat to see how using a deterministic dynamics can improve on random walks. I'm reminded of Jaynes: "It appears to be a quite general principle that, whenever there is a randomized way of doing something, then there is a nonrandomized way that delivers better performance but requires more thought."