Testing MCMC code
Roger B. Grosse, David K. Duvenaud

TL;DR
This paper discusses strategies for testing the correctness of MCMC algorithms, emphasizing modular code design and testing methods, demonstrated through a Python Gibbs sampling example.
Contribution
It introduces a modular testing framework for MCMC algorithms, combining unit and integration tests, with practical implementation guidance.
Findings
Modular code improves testability of MCMC algorithms
Unit and integration testing strategies are effective for debugging
Python example demonstrates practical testing approach
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.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsMarkov Chains and Monte Carlo Methods · Gaussian Processes and Bayesian Inference · Target Tracking and Data Fusion in Sensor Networks
