API
AdvancedVI.vi
— Functionvi(model, alg::VariationalInference)
vi(model, alg::VariationalInference, q::VariationalPosterior)
vi(model, alg::VariationalInference, getq::Function, θ::AbstractArray)
Constructs the variational posterior from the model
and performs the optimization following the configuration of the given VariationalInference
instance.
Arguments
model
:Turing.Model
orFunction
z ↦ log p(x, z) wherex
denotes the observationsalg
: the VI algorithm usedq
: aVariationalPosterior
for which it is assumed a specialized implementation of the variational objective used exists.getq
: function taking parametersθ
as input and returns aVariationalPosterior
θ
: only required ifgetq
is used, in which case it is the initial parameters for the variational posterior
AdvancedVI.ADVI
— Typestruct ADVI{AD} <: VariationalInference{AD}
Automatic Differentiation Variational Inference (ADVI) with automatic differentiation backend AD
.
Fields
samples_per_step::Int64
: Number of samples used to estimate the ELBO in each optimization step.max_iters::Int64
: Maximum number of gradient steps.adtype::Any
: AD backend used for automatic differentiation.