Forward variables underflow exponentially with T, so scale αt by ct=1/∑iαt(i); the scale factors cancel exactly in the reestimation formulas and logP(O∣λ)=−∑tlogct. Multiple observation sequences are handled by summing expected counts, each weighted by 1/Pk. Good initial emission estimates matter, small-sample estimates need interpolation or floors, and model size is chosen by experience.
Overview
Section V is explicitly practical (“seat-of-the-pants experience gained from working with HMMs over the last several years”) but contains exact derivations for scaling.
Main Content
Scaling (eqs 91-103)
αt(i) is a sum of terms ∏a∏b each below 1, so for t≳100 the dynamic range exceeds any machine precision. Define, with α~t(i)=∑jα^t−1(j)ajibi(Ot) and scale ct=1/∑iα~t(i) (eq. 91): α^t(i)=ctα~t(i). Then α^t(i)=(∏s≤tcs)αt(i)=Ctαt(i) and α^t(i)=αt(i)/∑jαt(j). Scaled backward variables use the same factors: β^t(i)=ctβt(i) (β^t=Dtβt with Dt=∏s≥tcs). In the reestimation of aij the factor CtDt+1=∏s=1Tcs=CT is independent of t and cancels between numerator and denominator, giving the exact unscaled formula in terms of scaled variables (eq. 98). Since ∏tct∑iαT(i)=1:
P(O∣λ)=∏t=1Tct1,logP(O∣λ)=−t=1∑Tlogct.
Scaling can be applied only when needed (set ct=1 at other times). Viterbi needs no scaling if done in logs (ϕt recursion, eqs 104-105).
Multiple observation sequences (eqs 106-111)
For left-right models a single sequence cannot train all parameters. With K independent sequences O(k), maximise P(O∣λ)=∏kP(O(k)∣λ)=∏kPk. Add the per-sequence expected counts:
πi is not reestimated for left-right (π1=1). With scaling, the same scale factors cancel in 1/Pk (eq. 111). This is the batched analogue of E24’s “padded multi-track HMM” (elk tracks as independent sequences with shared parameters).
Initial estimates (Sec. V.C)
No simple answer for reaching the global maximum. Random (subject to constraints) or uniform initialisation of π and A suffices in almost all cases. For B, good initial estimates are helpful in the discrete-symbol case and essential in the continuous (mixture) case, obtained by manual segmentation, maximum-likelihood segmentation with averaging, or segmental k-means with clustering.
Insufficient training data (Sec. V.D; eqs 112-113; Fig. 10)
(1) Enlarge the training set (often impractical); (2) reduce model size (often impossible); (3) interpolate with a smaller model λ′ for which data suffice: λˉˉ=ϵλ+(1−ϵ)λ′ (eq. 112), with ϵ estimated by deleted interpolation (Jelinek and Mercer 1980) by treating the interpolation as an expanded HMM with a neutral state s~ (Fig. 10) and running forward-backward on held-out partitions; (4) floors: require bj(k)≥δ (eq. 113a) or Ujk(r,r)≥δ (113b), with a post-processing step that corrects violations and rescales.
Choice of model (Sec. V.E). No theoretically correct rule: model type (ergodic or left-right), number of states, observation type (discrete or continuous, number of mixtures) are chosen by the physics of the signal and by experiment. A modern Bayesian answer is cross-validation or integrated LOO over the hidden path (E24).
Why scaling matters (numpy)
import numpy as nprng = np.random.default_rng(0)N, T = 3, 2000A = np.full((N,N), 1/N); b = rng.random((T,N))*0.2 # tiny emission likelihoodsalpha = np.ones(N)/N*b[0]; logp = 0.0for t in range(1, T): alpha = (alpha @ A)*b[t] c = alpha.sum(); alpha /= c; logp += np.log(c) # scale c_t^{-1}; logp = -sum log c_t (eq. 103)print(logp) # finite; unscaled alpha would be ~ 0.1^2000 -> underflow to 0.0 in float64
Connections
Log-space forward algorithms (logsumexp) in PyMC/JAX are the modern replacement for explicit scaling: Rabiner 1989 - Problem 1 - Forward and Backward Algorithms. Gradient-based Bayesian fitting avoids Baum-Welch initialisation issues but inherits multimodality as label switching.