Generalized Posteriors in Approximate Bayesian Computation
Abstract
Complex simulators have become a ubiquitous tool in many scientiﬁc disciplines, providing high-ﬁdelity, implicit probabilistic models of natural and social phenomena.
Unfortunately, they typically lack the tractability required for conventional statistical analysis.
Approximate Bayesian computation ( abc ) has emerged as a key method in simulation-based inference , wherein the true model likelihood and posterior are approximated using samples from the simulator.
In this paper, we draw connections between abc and generalized Bayesian inference ( gbi ).
First, we re-interpret the accept/reject step in abc as an implicitly deﬁned error model.
We then argue that these implicit error models will invariably be misspeciﬁed.
While abc posteriors are often treated as a necessary evil for approximating the standard
Bayesian posterior, this allows us to re-interpret abc as a potential robustiﬁcation strategy.
This leads us to suggest the use of gbi within abc , a use case we explore empirically.
1. Introduction
Approximate Bayesian computation ( abc ) is a family of techniques for computing approximate Bayesian posteriors in the presence of intractable likelihoods (see e.g.
Beaumont et al., 2002; Fan and Sisson, 2018; Beaumont, 2019).
Accordingly, such methods are particularly attractive when one is confronted with complex physical simulators .
Suppose we are given a probabilistic simulator f ( · | θ ) parameterized by θ ∈ Θ and deﬁning a probability distribution on X .
Assuming that (cid:82) X f
( x | θ ) d x = 1, this simulator also deﬁnes a likelihood.
If we have observations y and a prior belief p ( θ ), the standard Bayesian approach is to update our belief according to Bayes’ rule,
[Equation]
f ( y | θ ) p
( θ ) .
Clearly, this approach is infeasible for general simulation engines.
While we can sample x ∼ f ( · | θ ) for any θ ∈ Θ, evaluating f ( y | θ ) for a given y and θ is in general not possible.
The picture is further complicated by misspeciﬁcation: the simulator f ( · | θ ) will seldom describe the true data generating process y ∼ p ∗ ( · ) perfectly.
While many approaches exist for tackling this intractable likelihood problem (see e.g. Cranmer et al., 2020, for a recent overview), almost all of them rely on the assumption that the likelihood model deﬁned through the simulator is correctly speciﬁed.
In the following, we will show how generalized
Bayesian inference ( gbi ) can be used to design abc algorithms robust to misspeciﬁcation.
Operationally, abc describes the following algorithm: ﬁrst, sample θ ∼ p ( θ ); next, sample x | θ ∼ f ( x | θ ) by running the simulator with parameter θ ; lastly, weight the disagreement between x and the observed data y by comparing low-dimensional summary statistics, η ( x ) and η ( y ), as judged by some probability kernel function K h ( (cid:107) η ( x ) − η ( y ) (cid:107) ) with bandwidth h .
This induces an augmented distribution p ( θ, x | y ), a marginal of which yields an approximation to the Bayesian posterior
[Equation]
The logic in (1) is immediate: the smaller the bandwidth h of the kernel, the more accurate our approximation to the true posterior will be.
On the other hand, smaller bandwidths result in down-weighting or discarding more of the simulator outputs.
Further, one needs to choose a summary statistic η that is “as suﬃcient as possible” to optimally use all information in the data.
This tension between the theoretically optimal and the practically feasible is a recurrent theme within the literature on abc (e.g. Blum et al., 2013).
In the current paper, we use recent insights from gbi (see e.g. Gr¨unwald, 2012;
Bissiri et al., 2016; Jewson et al., 2018; Guedj, 2019; Knoblauch et al., 2019) to form a new perspective on these issues.
The ﬁrst key step is the reinterpretation of the kernel K h as the measurement error model for the true data y .
Unlike the standard interpretation of K h in abc , this suggests that larger bandwidths h could actually be beneﬁcial for more robust inferences.
More precisely, when the simulator is a poor description of y for any value of θ , an explicit model of the noise may robustify inference.
As the noise models themselves will also be misspeciﬁed, we further draw a natural connection to gbi : using generalizations of the
Bayesian principle, one can circumvent the drawbacks of having a substantially misspeciﬁed noise model.
In summary, rather than treating abc as a necessary evil for approximating the standard Bayesian posterior, we re-interpret it as a ﬂexible robustiﬁcation strategy.
2. Bayesian calibration of stochastic simulators
Traditional approaches for calibrating stochastic simulators assume that the model is wellspeciﬁed, inherent in the commonly stated aim to approximate the posterior of the simulator
[Equation]
However, if y is a real-world observation, it is rarely safe to assume it is drawn from the simulator.
On the contrary, it is reasonable to assume that the simulator is misspeciﬁed to a signiﬁcant degree—either because of measurement error in the data collection process or because of the modelling challenge of capturing the true dynamics.
The latter is of particular importance in the simulation of e.g. social dynamics and economic models, where any simulation-based method can at best provide a simpliﬁed view of real-world processes.
Consequently, we suggest augmenting the simulation model to incorporate measurement error in y .
Formally, we assume that there exists a measurement error (or noise ) model g such that the true data generating process p ∗ ∈ { p ( · | θ ); θ ∈ Θ } is given by [Equation] and p
[Equation]
While the error model g could in principle depend on θ as well, we do not consider this case in the remainder.
In practice of course, the “true” error distribution g is also unknown, so that relatively coarse approximations will have to be used instead.
For this reason we advocate the use of generalized Bayesian inference ( gbi ) (e.g. Bissiri et al., 2016, and
Appendix A) within abc to obtain robust posterior inference.
2.1. A general view on likelihood-free inference
gbi extends the logic of Bayesian belief updating from a likelihood function to an arbitrary loss (cid:96) .
Its main practical use lies in addressing robustness and misspeciﬁcation (see e.g.
Hooker and Vidyashankar, 2014; Ghosh and Basu, 2016; Jewson et al., 2018; Knoblauch et al., 2018).
Replacing the measurement error distribution with a general loss (cid:96) and plugging it into the relevant abc formulation yields
[Equation]
The above generalizes standard abc : instead of a probability kernel K h , one may now use any loss function (cid:96) to assess the discrepancy between x and y .
The weight w > 0 can be chosen to adjust the inﬂuence of a given loss on the posterior, and we illustrate this in
Figure 1 using a toy example which is described below in Section 3.
[Figure]
2.2. Links to approximate Bayesian computation
If the error distribution g ( y | x ) of (2) is identical to the kernel K h
( (cid:107) η
( x ) − η ( y ) (cid:107) )
, the corresponding abc algorithm recovers the correct posterior based on the likelihood p ( y | θ ) (rather than f ( y | θ )).
While this argument for interpreting the usual abc kernels as error distributions was previously made by Wilkinson (2013), it seems implausible that the correct measurement error of a complex simulator can be expressed in terms of a diﬀerence of low-dimensional summary statistics via K h .
Regardless, under this assumption one can substitute into (3) the unit weight w = 1 and the likelihood
[Equation]
to recover not only the abc posterior p abc ( θ | y ), but also the correct posterior based on the likelihood p ( y | θ ) of (2).
Doing so also demonstrates that the set of possible gbi posteriors in (3) contains all standard as well as a range of new and generalized abc posteriors, suggesting the traditional form (1) of abc posteriors is an artiﬁcial restriction.
Some popular abc kernels gain new interpretations viewed through this lens.
For example, K h is often taken to be a Gaussian kernel, implying through (4) the loss (cid:96) ( y ; x ) ∝ 12 h 2 (cid:107) η ( x ) − η ( y ) (cid:107) 2 .
This is a reasonable choice for (cid:96) whenever the (additive) observation noise on the summary statistics is at least approximately N (0 , h 2 ) distributed.
On the other hand, if N (0 , h 2 ) is a poor description of the error model, then gbi robustiﬁcation strategies could be deployed within abc (e.g. Knoblauch et al., 2018; Boustati et al., 2020).
In contrast, the appeal of many popular abc kernels is greatly reduced when viewed in this light.
For example, hard-threshold kernels given by indicator functions such as
K ε ( x, y ) =
1 {(cid:107) η
( x ) − η ( y ) (cid:107) < ε } would correspond to a compactly supported and discontinuous noise model g ( y | x ) =
K ε ( x, y ).
In virtually any other application, this choice of error model would be unconventional—yet it is commonplace in abc .
We submit that abc can elegantly address misspeciﬁcation by leveraging gbi : Under the gbi paradigm, we make more reasonable choices for K h —choices that more accurately reﬂect the measurement error g ( y | x )—that would be unnatural or even forbidden by the functional form of K h within standard abc .
While some pre-existing work on abc has taken small steps towards special cases of this generalization, these approaches do not consider the framework in its full generality (see e.g. Park et al., 2016; Ridgway, 2017).
2.3. Sampling from ABC posteriors
Given a choice of loss (cid:96) ( y ; x ), gbi requires us to compute expectations with respect to the posterior (3).
The most common approaches are sampling algorithms based on the pseudomarginal method (Beaumont, 2003; Andrieu et al., 2009).
Such samplers follow a Markov chain Monte Carlo ( mcmc ) approach: given a point { θ, (cid:96) ( y ; x ) } , propose θ (cid:48) ∼ N ( · ; θ, λ )—a
Gaussian centered at θ with variance λ —and (cid:96) ( y ; x (cid:48) ) with x (cid:48) ∼ f ( · | θ ) and accept with probability
[Equation]
otherwise remain in the same state.
An important result in mcmc theory is that the respective Markov chain will indeed converge to the desired target distribution (3).
The resulting algorithm can be seen as a generalization of the abc - mcmc scheme of Marjoram et al.
While we restrict our attention to mcmc methods, the suggested gbi target (3) is amenable to other popular abc algorithms, e.g. importance sampling as proposed by Park et al.
(2016) or smc - abc (Sisson et al., 2007) using, for instance, the methods of Fearnhead et al.
; Schmon et al.
3. Simulation Study
Throughout, we study the toy example of Frazier, David T. and Robert, Christian P. and Rousseau, Judith (2020).
In this example, we assume that the true generative model comes from the family with likelihood p ( x | θ ) =
N ( x ; θ, 2), that is, a Gaussian density with mean θ and variance 2.
We generate 100 data points according to an unobserved θ ∗ = 1, i.e. p ∗ ( y ) =
p ( y | θ ∗ ), where our prior beliefs about this parameter are given by p ( θ ) =
N ( θ ; 0 , 25).
Instead of reﬂecting the correct likelihood model, our simulator is misspeciﬁed and assumes that y was generated from f ( · | θ ) =
N ( x ; θ, 1).
Note that this means the true error has a distribution given by g ( y | x ) =
N ( y ; x, 1).
Our aim is to investigate the impact of the loss function on performance, as a judicious choice can not only help target the true posterior distribution, but may also substantially reduce the computational burden.
This highlights the use of gbi within abc for improved robustness and computational eﬃciency as outlined in Section 2.2.
Throughout, we focus on abc - mcmc algorithms (see e.g. Fan and Sisson, 2018) with soft-threshold losses, as we found this approach to perform very reliably.
Where summary statistics are used, we employ
the mean and variance η = ( η 1 , η 2 ), which are suﬃcient for the normal distribution.
The losses we consider take the form (cid:96) ( y ; x ) = 1 M (cid:80) Mi
=1 ˜ (cid:96) ( y ; x i ) where x i iid ∼ f ( · | θ ) and M denotes the number of simulator draws or particles .
For ˜ (cid:96) , we consider: the squared 2-norm applied to a diﬀerence of suﬃcient statistics, i.e. (cid:107) η
( x i ) − η ( y ) (cid:107) 2 , which we call st - abc ; the maximum mean discrepancy ( mmd ) loss as used in k
2- abc (Park et al., 2016); and the Wasserstein distance, which we call w - abc (note that our approach diﬀers from that of Bernton et al., 2019).
3.1. Solving the exact problem
Formulating simulation-based inference as a latent variable model as we propose in (2) might suggest that the aim of abc lies in an accurate modelling of the error distribution g ( y | x ), i.e. ﬁnding w · (cid:96) ( y ; x ) ≈ − log g ( y | x ).
However, in practice considerations such as computational cost and robustness may well trump the beneﬁts of modelling g ( y | x ) exactly.
In order to test this hypothesis, we leverage the fact that the true error distribution in our toy model is known and employ a pseudo-marginal algorithm (Beaumont, 2003; Andrieu et al., 2009) to sample exactly from the correct posterior p ( θ | y ).
We tune this algorithm so as to maximize the eﬀective sample size ( ess ) (using the ess function from the ArviZ library, Kumar et al. 2019) given a ﬁxed budget of draws from the simulator.
In particular, we choose the number of draws per iteration (this turns out to be more eﬃcient than taking just a single sample, see e.g. Pitt et al., 2012; Doucet et al., 2015; Schmon et al., 2020) so that the acceptance rate is around 25% (Schmon et al., 2020).
As a comparison we take the st - abc algorithm described above.
The abc algorithm uses an average of losses based on 15 samples, which improves the ess for a given number of calls to the simulator (see Figure 2), and is tuned so that it approximately targets the true posterior, as shown in Figure 3 in Appendix C. Further, we carry out a two sample Kolmogorov–Smirnov test on a subset of samples obtained from both methods, which demonstrates no signiﬁcant diﬀerence between the distributions. Given a budget of 1.5 million simulator calls, we compute the ess of both the pseudo-marginal chain and the abc chain.
While the pseudo-marginal algorithm achieves an ess of ≈ 2723, abc - mcmc results in an ess of more than 11080—making it more than four times as eﬃcient.
This has an important implication: while modelling the error distribution exactly may target the correct posterior, computational considerations may still favour alternative approaches.
3.2. General loss functions
The generalized posterior (3) allows for consideration of a wide variety of losses with diverse properties.
We compare a selection of losses against the following criteria:
i) Computational cost.
Calls to most simulators of interest are expensive.
Algorithms should make eﬃcient use of simulations, perhaps through use of M > 1 particles.
ii) Misspeciﬁcation robustness.
Algorithms oﬀering stable performance under high degrees of misspeciﬁcation are to be preferred.
Criterion i) is addressed in 2( a ).
In this experiment, each algorithm run draws 3 million samples from the simulator, eﬀectively ﬁxing the computational cost.
Those samples are spent on 3 million mcmc iterations with M = 1 particle, 1.5 million mcmc iterations with
M = 2 particles, and so on.
Finally, the eﬃciency is measured by the ess of the mcmc chain generated.
For low numbers of particles, k 2- abc and w - abc are vastly more eﬃcient than the more conventional st - abc .
Both k
2- abc and w - abc lose eﬃciency through any amount of loss-averaging.
In contrast, the ess of st - abc is maximised at around 15particles.
Turning to criterion ii), in 2( b ) we explore the behaviour of the algorithms under misspeciﬁcation.
Here, we have assumed that the true data generating process is N (1 , σ 2 ) and report the posterior mean of the abc - mcmc samples of each algorithm.
Further details are provided in Appendix B.
In agreement with 2( a ), st - abc produces posterior means of a far higher variance than the other losses, even using M = 2 particles (see Appendix B).
Using 64 particles improves performance for st - abc —and yet, both k
2- abc and w - abc still outperform it at every level of misspeciﬁcation using only a single particle .
[Figure]
4. Discussion
We have introduced a unifying view for likelihood-free inference methods by relating approximate Bayesian computation ( abc ) to generalized Bayesian inference ( gbi ).
Using the full expressivity of arbitrary loss functions allows us to re-interpret existing methods, but also suggests new promising directions for future research on abc .
We believe that this approach will broaden the scope of applicability for abc algorithms, particularly in applications where simulators are known to be inexact representations of the real world data-generating mechanism for y . Acknowledgments
JK is funded by the EPSRC grant EP/L016710/1 as part of the Oxford-Warwick Statistics
Programme (OxWaSP).
JK is additionally funded by the Facebook Fellowship Programme and the London Air Quality project at the Alan Turing Institute for Data Science and AI as part of the Lloyd’s Register Foundation programme on Data Centric Engineering.
This work was furthermore supported by The Alan Turing Institute for Data Science and AI under EPSRC grant EP/N510129/1 in collaboration with the Greater London Authority.
Appendix A. Generalized Bayesian Inference
Generalized Bayesian inference ( gbi ) is a family of Bayes-like methods based around Gibbs posteriors.
These methods can be justiﬁed from multiple angles, including the PACBayesian perspective (see Guedj, 2019, for a recent survey), the so-called Safe Bayes motivation of Gr¨unwald (2012), a discrepancy-based perspective on Bayesian inference (see
Jewson et al., 2018) as well as an optimization-centric view (see Knoblauch et al., 2019).
Perhaps most in line with the traditional Bayesian view is the conceptual justiﬁcation of
Bissiri et al.
Under a restrictive deﬁnition of coherent belief updates , the authors show that a Bayes-like update rule is a valid inferential device for general loss functions.
In particular, given a loss function (cid:96) : Θ × X → R with parameter space Θ and a prior belief p ( θ ) over Θ, one can show that a coherent belief update in the presence of an observation y ∈ X is given by the Bayes-like operation
[Equation]
Here, p (cid:96) ( θ | y ) is a coherent belief whenever the normalization constant (cid:82) exp( − (cid:96) ( y ; θ ))
p ( θ )d θ is ﬁnite.
This framework is appealing as it provides a new conceptual justiﬁcation for belief distributions that have been studied elsewhere, particularly in the PAC-Bayesian literature.
Appendix B. Further details to simulation study
In 2( b ) the true data generating process is a N (1 , σ 2 ), while the model is N ( θ, 1).
Each experiment comprises drawing a new observation y σ 2 = 1 + σξ , where ξ ∼ N (0 , 1); the seed is held ﬁxed so that ξ is constant across observations.
Then 3 × 10 6 Markov chain
Monte Carlo ( mcmc ) samples are generated from the respective sampler.
The dashed lines show the performance for a single particle, with the exception of soft-threshold approximate
Bayesian computation ( abc ), which exhibited too high variance in the eﬀective sample size ( ess ) estimate with only a single particle and so two particles were used.
Even with two particles, for reasonable levels of misspeciﬁcation ( σ 2 > 2 . 5) the ess for st - abc diminished extremely quickly.
Thus, not only do the posterior means drift further from the true value as misspeciﬁcation increases, but the algorithm itself ceases to function reliably.
This shortcoming was not present in any other algorithm tested.
In advance of running the experiments in Figure 2, each algorithm was tuned by setting its weight to approximately target the true posterior.
In that way, every algorithm tested could have been used to perform the same inferential task.
Once the weights were set, to verify the algorithms were producing samples approximately from the same distribution, sub-samples of length 150 were randomly sampled from each posterior chain and compared using a two-sample Kolmogorov–Smirnov test.
As the null hypothesis was not rejected at the 0.1 level for 5 diﬀerent observations y , we found the posteriors satisfactorily close.
Appendix C. Links to hidden Markov models
The view of a latent variable model with measurement error is one that is commonly used in the ﬁeld of hidden Markov models.
Following our previous notation, models consist of a hidden Markov chain evolving according to
[Equation]
Denote the observed time series y
=
( y (1) , . . .
, y ( n ) ), we can then recover expression (3) by setting
[Equation]
with f 1 ( x (1) | x (0) , θ ) =
f 1 ( x (1) | θ ) and f ( x |
[Equation]
[Equation]
Particle Markov chain Monte Carlo algorithms (Andrieu et al., 2010) are then designed to target posteriors like (2).
Accordingly, they are a possible solution for inference with gbi posteriors whenever the simulator is formulated as a hidden Markov model with known error.
It is noteworthy that for dynamic models particle Markov chain Monte Carlo ( pmcmc ) and abc are often competitors for solving the same task (e.g. Fasiolo et al., 2016).
However, it seems unreasonable to assume that the simulator is well-speciﬁed when employing one set of techniques (e.g. abc ) while assuming a measurement error model (e.g. pmcmc ).
In this sense, we suggest to decompose abc analogously to hidden Markov models into signal and noise and to consider abc with appropriately chosen loss as a robust inference method.
This is also in line with the results of Fasiolo et al.
(2016) who ﬁnd that pmcmc performs better when the model and noise are well-speciﬁed, but may underperform under model misspeciﬁcation.
Perhaps this could be alleviated using robust loss functions in the vein of (3) on their individual noise contributions as proposed Boustati et al.