Skip to main content
QUICK REVIEW

[Paper Review] Machine learning assisted Bayesian model comparison: learnt harmonic mean estimator

Jason D. McEwen, Christopher G. R. Wallis|arXiv (Cornell University)|Nov 24, 2021
Gaussian Processes and Bayesian InferenceComputer Science15 citations
TL;DR

This paper introduces the learnt harmonic mean estimator, a machine learning-augmented method for computing the marginal likelihood in Bayesian model comparison. By framing the harmonic mean estimator as importance sampling and learning an optimal target distribution to minimize variance, the method achieves robust, scalable computation of Bayesian evidence with up to 3–6× more samples in 1/3 the time compared to state-of-the-art methods.

ABSTRACT

We resurrect the infamous harmonic mean estimator for computing the marginal likelihood (Bayesian evidence) and solve its problematic large variance. The marginal likelihood is a key component of Bayesian model selection to evaluate model posterior probabilities; however, its computation is challenging. The original harmonic mean estimator, first proposed by Newton and Raftery in 1994, involves computing the harmonic mean of the likelihood given samples from the posterior. It was immediately realised that the original estimator can fail catastrophically since its variance can become very large (possibly not finite). A number of variants of the harmonic mean estimator have been proposed to address this issue although none have proven fully satisfactory. We present the \\emph{learnt harmonic mean estimator}, a variant of the original estimator that solves its large variance problem. This is achieved by interpreting the harmonic mean estimator as importance sampling and introducing a new target distribution. The new target distribution is learned to approximate the optimal but inaccessible target, while minimising the variance of the resulting estimator. Since the estimator requires samples of the posterior only, it is agnostic to the sampling strategy used. We validate the estimator on a variety of numerical experiments, including a number of pathological examples where the original harmonic mean estimator fails catastrophically. We also consider a cosmological application, where our approach leads to $\\sim$ 3 to 6 times more samples than current state-of-the-art techniques in 1/3 of the time. In all cases our learnt harmonic mean estimator is shown to be highly accurate. The estimator is computationally scalable and can be applied to problems of dimension $O(10^3)$ and beyond. Code implementing the learnt harmonic mean estimator is made publicly available

Motivation & Objective

  • Address the high variance and instability of the original harmonic mean estimator for marginal likelihood computation in Bayesian model selection.
  • Develop a scalable, robust method for computing Bayesian evidence that is agnostic to the posterior sampling strategy used.
  • Enable accurate and efficient model comparison in high-dimensional problems, including pathological cases where existing methods fail.
  • Provide a practical, open-source software implementation for widespread use in scientific computing and simulation-based inference.

Proposed method

  • Reinterpret the harmonic mean estimator as an importance sampling procedure with a new, learnable target distribution.
  • Train a machine learning model (specifically, a kernel density estimator) to approximate the optimal but intractable target distribution that minimizes estimator variance.
  • Use posterior samples from MCMC or ensemble samplers as input to train the target distribution, ensuring compatibility with any sampling method.
  • Minimize the variance of the resulting marginal likelihood estimator through differentiable optimization during model training.
  • Implement computational checks for estimator reliability, including variance estimation and sanity tests.
  • Integrate the method into the open-source harmonic software package, natively compatible with emcee and other MCMC samplers.

Experimental results

Research questions

  • RQ1Can a machine learning approach effectively stabilize the harmonic mean estimator by learning an optimal importance sampling target distribution?
  • RQ2Does the proposed method achieve significantly lower variance than the original harmonic mean estimator in high-dimensional or pathological posterior geometries?
  • RQ3To what extent can the learnt harmonic mean estimator scale to problems of dimension O(10^3) or higher while maintaining accuracy?
  • RQ4Can the method outperform state-of-the-art techniques like PolyChord in terms of sampling efficiency and evidence estimation accuracy?
  • RQ5Is the estimator robust and reliable across diverse benchmark problems and real-world applications, such as cosmological model comparison?

Key findings

  • The learnt harmonic mean estimator achieves highly accurate marginal likelihood estimates across all benchmark problems, including cases where the original harmonic mean estimator fails catastrophically.
  • In cosmological model comparison, the method enables approximately 3 to 6 times more posterior samples in 1/3 of the time compared to PolyChord, using the same hardware.
  • The estimator is computationally scalable and performs reliably on problems with dimensions up to O(10^3) and beyond.
  • The method is agnostic to the posterior sampling technique, allowing seamless integration with MCMC samplers like emcee, which naturally produce multiple chains.
  • The harmonic software package, implementing the estimator, achieves over 96% test coverage and is designed for production use with best software engineering practices.
  • The estimator's variance is significantly reduced compared to the original harmonic mean estimator by learning a target distribution that closely approximates the normalized posterior.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.