BayesianQuadrature.jl

Is there anything we can't make Bayesian?
Author theogf
Popularity
5 Stars
Updated Last
4 Months Ago
Started In
February 2021

BayesianQuadrature

Stable Dev Build Status Coverage Status Code Style: Blue

Package for implementing different methods of Bayesian quadrature. Bayesian quadrature consists in estimating the integral I = ∫ f(x) p(x) dx by using Gaussian Processes where p(x) is assumed to be Gaussian. More precisely we replace f(x) by a GP by estimating f for multiple samples x_i. We then get a posterior distribution for the integral : p(I|{x_i}) = N(m, S).

Given a Bayesian problem p(x|y) = p(y|x) p_0(x) / p(y) you can estimate p(y) by calling :

using BayesianQuadrature
using Distributions
using KernelFunctions
p_0 = MvNormal(ones(2)) # As for now the prior must be a MvNormal
log_f(x) = logpdf(MvNormal(0.5 * ones(2)), x) # The logarithm of the Integrand log_f, the log-likelihood function typically
model = BayesModel(p_0, log_f) # Combine both to create the model
bquad = BayesQuad(SEKernel(); l=0.1, σ=1.0) # Will simply approximate p(y|x) with a GP (only works with SEKernel for now
sampler = PriorSampling() # Will sample from the prior p_0
p_I, _ = bquad(model, sampler; nsamples=100) # Returns a Normal distribution
@show p_I # Normal{Float64}(μ=0.07063602778449946, σ=0.0028050929209120458)