Skip to main content

Module gaussian

Module gaussian 

Source
Expand description

Mean-field variational inference for a univariate Gaussian (PRML ch 10.1.3) — the canonical CAVI example. Data xₙ ~ N(μ, τ⁻¹) with a Normal-Gamma prior; the variational posterior is factorized q(μ,τ) = q(μ)·q(τ) (q(μ) Gaussian, q(τ) Gamma), and the coordinate-ascent updates iterate to a fixed point.

This is the worked instance of the general principle: approximate an intractable posterior by the closest factorized distribution, maximizing the ELBO.

Structs§

VariationalGaussian
The fitted factorized posterior q(μ) = N(μ_n, λ_n⁻¹), q(τ) = Gamma(a_n, b_n).

Functions§

fit
Run CAVI for the univariate Gaussian. Priors: μ ~ N(μ0, (λ0·τ)⁻¹) (mu0, lambda0), τ ~ Gamma(a0, b0). Fails closed on too little data.