Table of Contents
Fetching ...

Learned harmonic mean estimation of the Bayesian evidence with normalizing flows

Alicja Polanska, Matthew A. Price, Davide Piras, Alessio Spurio Mancini, Jason D. McEwen

TL;DR

The paper addresses Bayesian model comparison by improving evidence estimation through a learned harmonic mean estimator that uses normalizing flows to learn an internal importance target contained within the posterior. This yields a robust, sampler-agnostic method that remains accurate across low to high dimensions, demonstrated on benchmark problems and a DES Y1-like cosmology analysis, and complemented by an error-propagation framework in log space. The approach combines flow-based density learning (Real NVP and rational quadratic splines) with a concentration step via a flow temperature and standardized training to achieve stable evidence estimates, outperforming naïve flow methods and matching nested sampling benchmarks. The work provides open-source code, enabling scalable evidence estimation for complex cosmological and SBI settings, and highlights practical efficiency gains when leveraging saved MCMC chains or variational inferences for posterior samples.

Abstract

We present the learned harmonic mean estimator with normalizing flows - a robust, scalable and flexible estimator of the Bayesian evidence for model comparison. Since the estimator is agnostic to sampling strategy and simply requires posterior samples, it can be applied to compute the evidence using any Markov chain Monte Carlo (MCMC) sampling technique, including saved down MCMC chains, or any variational inference approach. The learned harmonic mean estimator was recently introduced, where machine learning techniques were developed to learn a suitable internal importance sampling target distribution to solve the issue of exploding variance of the original harmonic mean estimator. In this article we present the use of normalizing flows as the internal machine learning technique within the learned harmonic mean estimator. Normalizing flows can be elegantly coupled with the learned harmonic mean to provide an approach that is more robust, flexible and scalable than the machine learning models considered previously. We perform a series of numerical experiments, applying our method to benchmark problems and to a cosmological example in up to 21 dimensions. We find the learned harmonic mean estimator is in agreement with ground truth values and nested sampling estimates. The open-source harmonic Python package implementing the learned harmonic mean, now with normalizing flows included, is publicly available.

Learned harmonic mean estimation of the Bayesian evidence with normalizing flows

TL;DR

The paper addresses Bayesian model comparison by improving evidence estimation through a learned harmonic mean estimator that uses normalizing flows to learn an internal importance target contained within the posterior. This yields a robust, sampler-agnostic method that remains accurate across low to high dimensions, demonstrated on benchmark problems and a DES Y1-like cosmology analysis, and complemented by an error-propagation framework in log space. The approach combines flow-based density learning (Real NVP and rational quadratic splines) with a concentration step via a flow temperature and standardized training to achieve stable evidence estimates, outperforming naïve flow methods and matching nested sampling benchmarks. The work provides open-source code, enabling scalable evidence estimation for complex cosmological and SBI settings, and highlights practical efficiency gains when leveraging saved MCMC chains or variational inferences for posterior samples.

Abstract

We present the learned harmonic mean estimator with normalizing flows - a robust, scalable and flexible estimator of the Bayesian evidence for model comparison. Since the estimator is agnostic to sampling strategy and simply requires posterior samples, it can be applied to compute the evidence using any Markov chain Monte Carlo (MCMC) sampling technique, including saved down MCMC chains, or any variational inference approach. The learned harmonic mean estimator was recently introduced, where machine learning techniques were developed to learn a suitable internal importance sampling target distribution to solve the issue of exploding variance of the original harmonic mean estimator. In this article we present the use of normalizing flows as the internal machine learning technique within the learned harmonic mean estimator. Normalizing flows can be elegantly coupled with the learned harmonic mean to provide an approach that is more robust, flexible and scalable than the machine learning models considered previously. We perform a series of numerical experiments, applying our method to benchmark problems and to a cosmological example in up to 21 dimensions. We find the learned harmonic mean estimator is in agreement with ground truth values and nested sampling estimates. The open-source harmonic Python package implementing the learned harmonic mean, now with normalizing flows included, is publicly available.
Paper Structure (27 sections, 28 equations, 10 figures, 1 table)

This paper contains 27 sections, 28 equations, 10 figures, 1 table.

Figures (10)

  • Figure 1: Diagram illustrating how reducing the temperature parameter concentrates the probability density of a normalizing flow. The trained flow at $T=1$ is a normalized approximation of the posterior distribution. The variance of the base distribution, which we call the temperature parameter $T \in (0,1)$, is reduced, concentrating the probability density of the transformed distribution. This ensures that it is contained within the posterior, which is a necessary condition for the internal learned importance target distribution of the learned harmonic mean estimator.
  • Figure 2: Corner plot of the sampled posterior (solid red) and a real NVP flow with temperature $T=0.9$ (dashed blue) for the Rosenbrock benchmark problem. The internal importance target distribution of the estimator given by the concentrated flow is contained within the posterior, as required for the learned harmonic mean estimator.
  • Figure 3: Violin plots of the reciprocal Bayesian evidence computed by the learned harmonic mean estimator for the Rosenbrock benchmark problem repeated $100$ times. (a) Reciprocal Bayesian evidence estimates across runs (measured) along with the estimate of the standard deviation computed by the error estimator (estimated). The ground truth is shown in red. (b) Sample variance of the estimator across runs (measured) alongside the standard deviation computed by the variance-of-variance estimator (estimated). The evidence estimates and their error estimators are highly accurate.
  • Figure 4: (a) Corner plot of the sampled posterior (solid red) and real NVP flow with temperature $T=0.9$ (dashed blue) for the Normal-Gamma example with $\tau_{0}=0.001$. The internal importance target distribution given by the concentrated flow is contained within the posterior, as required for the learned harmonic mean estimator. (b) Ratio of Bayesian evidence values computed by the learned harmonic mean estimator with a concentrated flow to those computed analytically for the Normal-Gamma problem with error bars corresponding to the estimated standard deviation. Bayesian evidence estimated with a flow at temperature $T=0.9$ (blue) and $T=0.95$ (green) are shown, with slight offsets for ease of visualization. Unlike the original harmonic mean, our method produces accurate estimates which are sensitive to prior size.
  • Figure 5: Corner plots of the sampled posterior (solid red) and real NVP flow trained on the posterior samples with temperature $T=0.9$ (dashed blue) for the Pima Indian benchmark problem for $\tau=0.01$. The dimensions correspond to parameters $\theta_{i}$ associated with the covariates included in the analysis. The internal importance target distribution given by the concentrated flow is contained within the posterior and has thinner tails, as required for the learned harmonic mean estimator.
  • ...and 5 more figures