Skip to main content

Module engine

Module engine 

Source
Expand description

Variational Message Passing engine.

Implements Winn & Bishop (2005) VMP for conjugate-exponential models built on three families: Gaussian (mean-unknown / precision-known), Categorical, and Dirichlet. The engine consumes a structural description via VmpConfig and runs coordinate-ascent natural-parameter updates until the ELBO / L∞ residual converges.

The algorithm is independent of the discrete factor-potential tables carried by the FactorGraph type: VMP operates purely in continuous natural-parameter space. The user is therefore required to annotate each variable with its family and each factor with its conjugate role (see VmpFactor).

§High-level flow

  1. Initialise each variable’s variational distribution q(v) from its prior.
  2. For each iteration:
    • For every variable v in a deterministic order:
      • Accumulate contributions from every adjacent factor (natural-parameter deltas).
      • Replace q(v)’s natural parameters by prior_nat + Σ Δ.
    • Compute the ELBO.
  3. Stop when |ΔELBO| < ε or the maximum natural-parameter residual < ε.

Divergence (ELBO decreasing by more than a small tolerance) is detected and surfaced as a ConvergenceFailure error so the caller does not silently consume a broken result.

Structs§

VariationalMessagePassing
The VMP coordinate-ascent engine.
VmpConfig
User-facing configuration describing a VMP problem.
VmpResult
Summary of a VMP run.

Enums§

Family
Variational family assigned to a variable.
VariationalState
Variational state carried for a single variable.
VmpFactor
Conjugate relationship represented by a single factor.