English

Testing MCMC code

Software Engineering 2014-12-18 v1 Machine Learning Machine Learning

Abstract

Markov Chain Monte Carlo (MCMC) algorithms are a workhorse of probabilistic modeling and inference, but are difficult to debug, and are prone to silent failure if implemented naively. We outline several strategies for testing the correctness of MCMC algorithms. Specifically, we advocate writing code in a modular way, where conditional probability calculations are kept separate from the logic of the sampler. We discuss strategies for both unit testing and integration testing. As a running example, we show how a Python implementation of Gibbs sampling for a mixture of Gaussians model can be tested.

Keywords

Cite

@article{arxiv.1412.5218,
  title  = {Testing MCMC code},
  author = {Roger B. Grosse and David K. Duvenaud},
  journal= {arXiv preprint arXiv:1412.5218},
  year   = {2014}
}

Comments

Presented at the 2014 NIPS workshop on Software Engineering for Machine Learning

R2 v1 2026-06-22T07:34:16.181Z