ConjugateComputationVI.GaussHermiteQuadrature
— TypeGaussHermiteQuadrature(num_points::Int)
Specify that the expectation required for the reconstruction term is to be computed using Gauss-Hermite quadrature with num_points
quadrature points.
ConjugateComputationVI.UnivariateFactorisedLikelihood
— TypeUnivariateFactorisedLikelihood(build_lik)
A likelihood function which factorises across inputs. Applying this likelihood to any vector f::AbstractVector{<:Real}
yields a Product
distribution. Exposing this structure is useful when working with quadrature methods.
AbstractGPs.elbo
— Methodelbo(
f::AbstractGP,
x::AbstractVector,
η1::AbstractVector{<:Real},
η2::AbstractVector{<:Real},
r,
)
Compute the evidence lower bound associated with the GP f
, with reconstruction term r
, variational parameters η1
and η2
, and collection of inputs x
.
ConjugateComputationVI.approx_posterior
— Methodapprox_posterior(
f::AbstractGP,
x::AbstractVector,
η1::AbstractVector{<:Real},
η2::AbstractVector{<:Real},
)
Compute the approximate posterior. This is just a posterior GP some kind, which is another AbstractGP.
ConjugateComputationVI.batch_quadrature
— Methodbatch_quadrature(
fs::AbstractVector,
ms::AbstractVector{<:Real},
σs::AbstractVector{<:Real},
num_points::Integer,
)
Approximate the integrals
∫ fs[n](x) pdf(Normal(ms[n], σs[n]), x) dx
for all n
in eachindex(fs)
using Gauss-Hermite quadrature with num_points
.
ConjugateComputationVI.canonical_from_expectation
— Methodcanonical_from_expectation(m1::AbstractVector{<:Real}, m2::AbstractVector{<:Real})
Compute canonical parameters m
and σ²
from expectation parameters m1
and m2
. Inverse of expectation_from_canonical
.
ConjugateComputationVI.canonical_from_natural
— Methodcanonical_from_natural(η1::AbstractVector{<:Real}, η2::AbstractVector{<:Real})
Compute canonical parameters y
and σ²
from natural parameters η1
and η2
. Inverse of natural_from_canonical
.
ConjugateComputationVI.expectation_from_canonical
— Methodexpectation_from_canonical(m::AbstractVector{<:Real}, σ²::AbstractVector{<:Real})
Compute expectation parameters m1
and m2
from canonical parameters m
and σ²
. Inverse of expectation_from_canonical
.
ConjugateComputationVI.gaussian_reconstruction_term
— Methodgaussian_reconstruction_term(
y::AbstractVector{<:Real},
σ²::AbstractVector{<:Real},
m̃::AbstractVector{<:Real},
σ̃²::AbstractVector{<:Real},
)
Computes
∫ logpdf(Normal(f, σ²[n]), y[n]) pdf(Normal(m̃[n], σ̃²[n]), f) df
for each n ∈ eachindex(y)
.
ConjugateComputationVI.natural_from_canonical
— Methodnatural_from_canonical(y::AbstractVector{<:Real}, σ²::AbstractVector{<:Real})
Compute natural parameters η1
and η2
from canonical paramters y
and σ²
. Inverse of canonical_from_natural
.
ConjugateComputationVI.optimise_approx_posterior
— Methodoptimise_approx_posterior(
f::AbstractGP,
x::AbstractVector,
η1::AbstractVector{<:Real},
η2::AbstractVector{<:Real},
∇r,
ρ::Real;
max_iterations=1_000,
gtol=1e-8,
)
ConjugateComputationVI.optimize_elbo
— Methodoptimize_elbo(
build_latent_gp,
integrater::AbstractIntegrater,
x::AbstractVector,
y::AbstractVector,
θ0::AbstractVector{<:Real},
optimiser,
options,
)
Optimise the elbo w.r.t. model parameters.
Arguments
build_latent_gp
: a unary function accepting anAbstractVector{<:Real}
returning a LatentGPintegrater
::AbstractIntegrater: an object specifying how to perform inferencex::AbstractVector
: a collection of inputsy::AbstractVector
: a collection of outputsθ0::AbstractVector{<:Real}
: initial model parameter valuesoptimiser
: an optimiser that can be passed toOptim.optimize
options
: options to be passed toOptim.optimize
Returns
AbstractGP
: the approximate posterior at the optimumNamedTuple
: results summary containing various useful bits of information
ConjugateComputationVI.update_approx_posterior
— Methodupdate_approx_posterior(
f::AbstractGP,
x::AbstractVector,
η1::AbstractVector{<:Real},
η2::AbstractVector{<:Real},
r,
ρ::Real,
)