- Source: Bayesian quadrature
Bayesian quadrature
is a method for approximating intractable integration problems. It falls within the class of probabilistic numerical methods. Bayesian quadrature views numerical integration as a Bayesian inference task, where function evaluations are used to estimate the integral of that function. For this reason, it is sometimes also referred to as "Bayesian probabilistic numerical integration" or "Bayesian numerical integration". The name "Bayesian cubature" is also sometimes used when the integrand is multi-dimensional. A potential advantage of this approach is that it provides probabilistic uncertainty quantification for the value of the integral.
Bayesian quadrature
= Numerical integration
=Let
f
:
X
→
R
{\displaystyle f:{\mathcal {X}}\rightarrow \mathbb {R} }
be a function defined on a domain
X
{\displaystyle {\mathcal {X}}}
(where typically
X
⊆
R
d
{\displaystyle {\mathcal {X}}\subseteq \mathbb {R} ^{d}}
).
In numerical integration, function evaluations
f
(
x
1
)
,
…
,
f
(
x
n
)
{\displaystyle f(x_{1}),\ldots ,f(x_{n})}
at distinct locations
x
1
,
…
,
x
n
{\displaystyle x_{1},\ldots ,x_{n}}
in
X
{\displaystyle {\mathcal {X}}}
are used to estimate the integral of
f
{\displaystyle f}
against a measure
ν
{\displaystyle \nu }
: i.e.
ν
[
f
]
:=
∫
X
f
(
x
)
ν
(
d
x
)
.
{\displaystyle \textstyle \nu [f]:=\int _{\mathcal {X}}f(x)\nu (\mathrm {d} x).}
Given weights
w
1
,
…
,
w
n
∈
R
{\displaystyle w_{1},\ldots ,w_{n}\in \mathbb {R} }
, a quadrature rule is an estimator of
ν
[
f
]
{\displaystyle \nu [f]}
of the form
ν
^
[
f
]
:=
∑
i
=
1
n
w
i
f
(
x
i
)
.
\textstyle {\hat {\nu }}[f]:=\sum _{i=1}^{n}w_{i}f(x_{i}).
Bayesian quadrature consists of specifying a prior distribution over
f
{\displaystyle f}
, conditioning this prior on
f
(
x
1
)
,
…
,
f
(
x
n
)
{\displaystyle f(x_{1}),\ldots ,f(x_{n})}
to obtain a posterior distribution
f
{\displaystyle f}
, then computing the implied posterior distribution on
ν
[
f
]
{\displaystyle \nu [f]}
. The name "quadrature" comes from the fact that the posterior mean on
ν
[
f
]
{\displaystyle \nu [f]}
sometimes takes the form of a quadrature rule whose weights are determined by the choice of prior.
= Bayesian quadrature with Gaussian processes
=The most common choice of prior distribution for
f
{\displaystyle f}
is a Gaussian process as this permits conjugate inference to obtain a closed-form posterior distribution on
ν
[
f
]
{\displaystyle \nu [f]}
. Suppose we have a Gaussian process with prior mean function
m
:
X
→
R
{\displaystyle m:{\mathcal {X}}\rightarrow \mathbb {R} }
and covariance function (or kernel function)
k
:
X
×
X
→
R
{\displaystyle k:{\mathcal {X}}\times {\mathcal {X}}\rightarrow \mathbb {R} }
. Then, the posterior distribution on
f
{\displaystyle f}
is a Gaussian process with mean
m
n
:
X
→
R
{\displaystyle m_{n}:{\mathcal {X}}\rightarrow \mathbb {R} }
and kernel
k
n
:
X
×
X
→
R
{\displaystyle k_{n}:{\mathcal {X}}\times {\mathcal {X}}\rightarrow \mathbb {R} }
given by:
m
n
(
x
)
=
m
(
x
)
+
k
(
x
,
X
)
k
(
X
,
X
)
−
1
f
(
X
)
and
k
n
(
x
,
y
)
=
k
(
x
,
y
)
−
k
(
x
,
X
)
k
(
X
,
X
)
−
1
k
(
X
,
y
)
.
{\displaystyle m_{n}(x)=m(x)+k(x,X)k(X,X)^{-1}f(X)\qquad {\text{and}}\qquad k_{n}(x,y)=k(x,y)-k(x,X)k(X,X)^{-1}k(X,y).}
where
(
k
(
X
,
X
)
)
i
j
=
k
(
x
i
,
x
j
)
{\displaystyle (k(X,X))_{ij}=k(x_{i},x_{j})}
,
(
f
(
X
)
)
i
=
f
(
x
i
)
{\displaystyle (f(X))_{i}=f(x_{i})}
,
(
k
(
⋅
,
X
)
)
i
=
k
(
⋅
,
x
i
)
{\displaystyle (k(\cdot ,X))_{i}=k(\cdot ,x_{i})}
and
(
k
(
X
,
⋅
)
)
i
=
k
(
x
i
,
⋅
)
{\displaystyle (k(X,\cdot ))_{i}=k(x_{i},\cdot )}
.
Furthermore, the posterior distribution on
ν
[
f
]
{\displaystyle \nu [f]}
is a univariate Gaussian distribution with mean
E
[
ν
[
f
]
]
{\displaystyle \mathbb {E} [\nu [f]]}
and variance
V
[
ν
[
f
]
]
{\displaystyle \mathbb {V} [\nu [f]]}
given by
E
[
ν
[
f
]
]
=
ν
[
m
]
+
ν
[
k
(
⋅
,
X
)
]
k
(
X
,
X
)
−
1
f
(
X
)
and
V
[
ν
[
f
]
]
=
ν
ν
[
k
]
−
ν
[
k
(
⋅
,
X
)
]
k
(
X
,
X
)
−
1
ν
[
k
(
X
,
⋅
)
]
.
{\displaystyle \mathbb {E} [\nu [f]]=\nu [m]+\nu [k(\cdot ,X)]k(X,X)^{-1}f(X)\qquad {\text{and}}\qquad \mathbb {V} [\nu [f]]=\nu \nu [k]-\nu [k(\cdot ,X)]k(X,X)^{-1}\nu [k(X,\cdot )].}
The function
ν
[
k
(
⋅
,
x
)
]
=
∫
X
k
(
y
,
x
)
ν
(
d
y
)
{\displaystyle \textstyle \nu [k(\cdot ,x)]=\int _{\mathcal {X}}k(y,x)\nu (\mathrm {d} y)}
is the kernel mean embedding of
k
{\displaystyle k}
and
ν
ν
[
k
]
=
∫
X
k
(
x
,
y
)
ν
(
d
x
)
ν
(
d
y
)
{\displaystyle \textstyle \nu \nu [k]=\int _{\mathcal {X}}k(x,y)\nu (dx)\nu (\mathrm {d} y)}
denotes the integral of
k
{\displaystyle k}
with respect to both inputs.
In particular, note that the posterior mean is a quadrature rule with weights
w
i
=
(
ν
[
k
(
⋅
,
X
)
]
k
(
X
,
X
)
−
1
)
i
.
{\displaystyle \textstyle w_{i}=(\nu [k(\cdot ,X)]k(X,X)^{-1})_{i}.}
and the posterior variance provides a quantification of the user's uncertainty over the value of
ν
[
f
]
{\displaystyle \nu [f]}
.
In more challenging integration problems, where the prior distribution cannot be relied upon as a meaningful representation of epistemic uncertainty, it is necessary to use the data
f
(
x
1
)
,
…
,
f
(
x
n
)
{\displaystyle f(x_{1}),\ldots ,f(x_{n})}
to set the kernel hyperparameters using, for example, maximum likelihood estimation. The estimation of kernel hyperparameters introduces adaptivity into Bayesian quadrature.
= Example
=Consider estimation of the integral
ν
[
f
]
=
∫
0
1
f
(
x
)
d
x
≈
1.79
of the function
f
(
x
)
=
(
1
+
x
2
)
sin
(
5
π
x
)
+
8
5
{\displaystyle \nu [f]=\int _{0}^{1}f(x)\,\mathrm {d} x\approx 1.79\quad {\text{ of the function }}\quad f(x)=(1+x^{2})\sin(5\pi x)+{\frac {8}{5}}}
using a Bayesian quadrature rule based on a zero-mean Gaussian process prior with the Matérn covariance function of smoothness
3
/
2
{\displaystyle 3/2}
and correlation length
ρ
=
1
/
5
{\displaystyle \rho =1/5}
.
This covariance function is
k
(
x
,
y
)
=
(
1
+
3
|
x
−
y
|
/
ρ
)
exp
(
−
3
|
x
−
y
|
/
ρ
)
.
{\displaystyle \textstyle k(x,y)=(1+{\sqrt {3}}\,|x-y|/\rho )\exp(\!-{\sqrt {3}}\,|x-y|/\rho ).}
It is straightforward (though tedious) to compute that
ν
[
k
(
⋅
,
x
)
]
=
∫
0
1
k
(
y
,
x
)
d
y
=
4
ρ
3
−
1
3
exp
(
3
(
x
−
1
)
ρ
)
(
3
+
2
3
ρ
−
3
x
)
−
1
3
exp
(
−
3
x
ρ
)
(
3
x
+
2
3
ρ
)
{\displaystyle \nu [k(\cdot ,x)]=\int _{0}^{1}k(y,x)\,\mathrm {d} y={\frac {4\rho }{\sqrt {3}}}-{\frac {1}{3}}\exp {\bigg (}{\frac {{\sqrt {3}}(x-1)}{\rho }}{\bigg )}{\big (}3+2{\sqrt {3}}\,\rho -3x{\big )}-{\frac {1}{3}}\exp {\bigg (}-{\frac {{\sqrt {3}}\,x}{\rho }}{\bigg )}{\big (}3x+2{\sqrt {3}}\,\rho {\big )}}
ν
ν
[
k
]
=
∫
0
1
∫
0
1
k
(
x
,
y
)
d
x
d
y
=
2
ρ
3
[
2
3
−
3
ρ
+
exp
(
−
3
ρ
)
(
3
+
3
ρ
)
]
.
{\displaystyle \nu \nu [k]=\int _{0}^{1}\int _{0}^{1}k(x,y)\,\mathrm {d} x\,\mathrm {d} y={\frac {2\rho }{3}}{\Bigg [}2{\sqrt {3}}-3\rho +\exp {\bigg (}\!-{\frac {\sqrt {3}}{\rho }}{\bigg )}{\big (}{\sqrt {3}}+3\rho {\big )}{\Bigg ]}.}
Convergence of the Bayesian quadrature point estimate
E
[
ν
[
f
]
]
{\displaystyle \mathbb {E} [\nu [f]]}
and concentration of the posterior mass, as quantified by
V
[
ν
[
f
]
]
{\displaystyle \mathbb {V} [\nu [f]]}
, around the true integral
ν
[
f
]
{\displaystyle \nu [f]}
as
f
{\displaystyle f}
is evaluated at more and more points is displayed in the accompanying animation.
= Advantages and disadvantages
=Since Bayesian quadrature is an example of probabilistic numerics, it inherits certain advantages compared with traditional numerical integration methods:
It allows uncertainty to be quantified and propagated through all subsequent computations to explicitly model the impact of numerical error.
It provides a principled way to incorporate prior knowledge by using a judicious choice of prior distributions for
f
{\displaystyle f}
, which may be more sophisticated compared to the standard Gaussian process just described.
It permits more efficient use of information, e.g. jointly inferring multiple related quantities of interest or using active learning to reduce the required number of points.
Despite these merits, Bayesian quadrature methods possess the following limitations:
Although the Bayesian paradigm allows a principled treatment of the quantification of uncertainty, posterior inference over
ν
[
f
]
{\displaystyle \nu [f]}
is not always tractable, thus requiring a second-level estimation. E.g. for Bayesian quadrature with Gaussian processes, the kernel mean embedding
ν
[
k
(
⋅
,
x
)
]
{\displaystyle \nu [k(\cdot ,x)]}
has no closed-form expression for a general kernel
k
{\displaystyle k}
and measure
ν
{\displaystyle \nu }
.
The computational cost of Bayesian quadrature methods based on Gaussian processes is in general
O
(
n
3
)
{\displaystyle {\mathcal {O}}(n^{3})}
due to the cost of inverting
n
×
n
{\displaystyle n\times n}
matrices, which may defy their applications to large-scale problems.
Algorithmic design
= Prior distributions
=The most commonly used prior for
f
{\displaystyle f}
is a Gaussian process prior. This is mainly due to the advantage provided by Gaussian conjugacy and the fact that Gaussian processes can encode a wide range of prior knowledge including smoothness, periodicity and sparsity through a careful choice of prior covariance. However, a number of other prior distributions have also been proposed. This includes multi-output Gaussian processes, which are particularly useful when tackling multiple related numerical integration tasks simultaneously or sequentially, and tree-based priors such as Bayesian additive regression trees, which are well suited for discontinuous
f
{\displaystyle f}
. Additionally, Dirichlet processes priors have also been proposed for the integration measure
ν
{\displaystyle \nu }
.
= Point selection
=The points
x
1
,
…
,
x
n
{\displaystyle x_{1},\ldots ,x_{n}}
are either considered to be given, or can be selected so as to ensure the posterior on
ν
[
f
]
{\displaystyle \nu [f]}
concentrates at a faster rate. One approach consists of using point sets from other quadrature rules. For example, taking independent and identically distributed realisations from
ν
{\displaystyle \nu }
recovers a Bayesian approach to Monte Carlo, whereas using certain deterministic point sets such as low-discrepancy sequences or lattices recovers a Bayesian alternative to quasi-Monte Carlo. It is of course also possible to use point sets specifically designed for Bayesian quadrature; see for example the work of
who exploited symmetries in point sets to obtain scalable Bayesian quadrature estimators. Alternatively, points can also be selected adaptively following principles from active learning and Bayesian experimental design so as to directly minimise posterior uncertainty, including for multi-output Gaussian processes.
= Kernel mean and initial error
=One of the challenges when implementing Bayesian quadrature is the need to evaluate the function
ν
[
k
(
⋅
,
x
)
]
{\displaystyle \nu [k(\cdot ,x)]}
and the constant
ν
ν
[
k
]
{\displaystyle \nu \nu [k]}
. The former is commonly called the kernel mean, and is a quantity which is key to the computation of kernel-based distances such as the maximum mean discrepancy. The latter is commonly called the initial error since it provides an upper bound on the integration error before any function values are observed. Unfortunately, the kernel mean and initial error can only be computed for a small number of
(
k
,
ν
)
{\displaystyle (k,\nu )}
pairs; see for example Table 1 in.
Theory
There have been a number of theoretical guarantees derived for Bayesian quadrature. These usually require Sobolev smoothness properties of the integrand, although recent work also extends to integrands in the reproducing kernel Hilbert space of the Gaussian kernel. Most of the results apply to the case of Monte Carlo or deterministic grid point sets, but some results also extend to adaptive designs.
Software
ProbNum: Probabilistic numerical methods in Python, including a Bayesian quadrature implementation.
Emukit: Emulation and decision making under uncertainty in Python.
QMCPy: Bayesian quadrature with QMC point sets in Python.