API

AdvancedVI.viFunction
vi(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 or Function z ↦ log p(x, z) where x denotes the observations
  • alg: the VI algorithm used
  • q: a VariationalPosterior for which it is assumed a specialized implementation of the variational objective used exists.
  • getq: function taking parameters θ as input and returns a VariationalPosterior
  • θ: only required if getq is used, in which case it is the initial parameters for the variational posterior
source
AdvancedVI.ADVIType
struct 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.

source