Skip to main content

Module variational

Module variational 

Source
Expand description

Variational Bayes EM for Hidden Markov Models with Dirichlet priors.

Reference: Beal 2003, “Variational Algorithms for Approximate Bayesian Inference”, §3.4.

Standard Baum-Welch places ML point estimates on π, A, B. VB-EM instead places conjugate Dirichlet priors on those parameters and maintains a factored variational posterior q(π, A, B) = q(π) · ∏_i q(A_i) · ∏_i q(B_i) whose factors are themselves Dirichlet distributions. The sufficient statistics from forward-backward (computed with expected log-parameters derived via the digamma function) update the Dirichlet concentration parameters in the M-step, and the ELBO is tracked for convergence.

Structs§

VbHmmConfig
Configuration for Variational Bayes HMM training.
VbHmmResult
Result of Variational Bayes HMM training.

Functions§

digamma
Scalar digamma function ψ(x) implemented via upward recursion followed by an asymptotic Stirling expansion.
dirichlet_log_normalizer
Log-normaliser of a Dirichlet distribution: log B(α) = Σ_i ln Γ(α_i) − ln Γ(Σ_i α_i).
log_gamma
Log-Gamma function ln Γ(x) via the Lanczos approximation with g = 7 and 9 pre-computed coefficients (Spouge 1994 / Numerical Recipes form).
variational_hmm
Run Variational Bayes EM for a discrete HMM with Dirichlet priors.