Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Online EM for exponential families

Online expectation–maximization replaces a full-data E-step by a running average of posterior sufficient statistics. Cappé and Moulines develop the general method in 2009, On-line expectation–maximization algorithm for latent data models. This note specializes the update to a full exponential family, derives the upstream regret identity, and applies the same statistic order as batch EM for GH.

Read the exponential-family core for natural and expectation coordinates and IG duality for Bregman divergences. Throughout the full-family derivation, assume a regular minimal family, finite posterior statistics, and iterates in an interior region where the expectation-to-natural map exists. Matrix statistic blocks use their independent symmetric coordinates.

Posterior statistics and the sequential update

For observed XX and hidden YY, write

f(x,y;θ)=h(x,y)exp{θ,t(x,y)ψ(θ)},η=ψ(θ).f(x,y;\theta)=h(x,y)\exp\{\langle\theta,t(x,y)\rangle-\psi(\theta)\}, \qquad \eta=\nabla\psi(\theta).

Let ϕ(η)=θ,ηψ(θ)\phi(\eta)=\langle\theta,\eta\rangle-\psi(\theta) be the Legendre dual, so that θ=ϕ(η)\theta=\nabla\phi(\eta). At observation xtx_t, compute

tˉt=Eθt1[t(X,Y)X=xt].\bar t_t=\mathbb E_{\theta_{t-1}}[t(X,Y)\mid X=x_t].

Starting from η0=ψ(θ0)\eta_0=\nabla\psi(\theta_0), update

ηt=(1ρt)ηt1+ρttˉt,θt=ϕ(ηt).\begin{aligned} \eta_t&=(1-\rho_t)\eta_{t-1}+\rho_t\bar t_t,\\ \theta_t&=\nabla\phi(\eta_t). \end{aligned}

The reciprocal schedule ρt=1/(τ0+t)\rho_t=1/(\tau_0+t), with τ00\tau_0\geq0, has the exact aggregation identity

ηT=τ0η0+t=1Ttˉtτ0+T.\eta_T=\frac{\tau_0\eta_0+\sum_{t=1}^T\bar t_t}{\tau_0+T}.

Here ρt\rho_t is the step size; τt=τ0+t\tau_t=\tau_0+t is its reciprocal. The initial statistic has weight τ0\tau_0 in pseudo-observation units. Each tˉt\bar t_t uses the parameter available when that observation arrives; it is not recomputed under θT\theta_T. Thus this average differs from a batch E-step at the final parameter. With τ0=0\tau_0=0, the first update can lie on the boundary, so the assumed inverse map needs particular care.

For a mini-batch, replace tˉt\bar t_t by its within-batch average. A constant ρt\rho_t gives exponential forgetting. Decreasing schedules satisfying tρt=\sum_t\rho_t=\infty and tρt2<\sum_t\rho_t^2<\infty are common in stationary stochastic approximation; for example (t+t0)κ(t+t_0)^{-\kappa} with 1/2<κ11/2<\kappa\leq1. These conditions alone do not prove convergence: stability, regularity, and a suitable M-step are also needed. The method’s cost per update uses fewer observations than batch EM, but this does not imply the same convergence rate or likelihood ascent at each observation.

A Bregman regret identity

Define the complete-data divergence, with its orientation explicit,

Dψ(θθ0)=ψ(θ)ψ(θ0)η0,θθ0=DKL(fθ0(X,Y)fθ(X,Y)).D_\psi(\theta\Vert\theta_0) =\psi(\theta)-\psi(\theta_0) -\langle\eta_0,\theta-\theta_0\rangle =D_{\mathrm{KL}}(f_{\theta_0}(X,Y)\Vert f_\theta(X,Y)).

For a sequence x1,,xTx_1,\ldots,x_T, compare sequential prediction with a fixed parameter chosen using all observations and this initial penalty:

rT=t=1TlogfX(xt;θt1)minθ{t=1TlogfX(xt;θ)+τ0Dψ(θθ0)}.\begin{aligned} r_T&=-\sum_{t=1}^T\log f_X(x_t;\theta_{t-1})\\ &\quad-\min_\theta\left\{-\sum_{t=1}^T\log f_X(x_t;\theta) +\tau_0D_\psi(\theta\Vert\theta_0)\right\}. \end{aligned}

Suppose this minimum is finite and attained at an interior θ\theta_*, and put η=ψ(θ)\eta_*=\nabla\psi(\theta_*). For the reciprocal schedule above, the upstream decomposition is

rT=t=1TτtDψ(θt1θt)+t=1TDKL ⁣(fθt1(Yxt)fθ(Yxt))τTDϕ(ηTη).\begin{aligned} r_T&=\sum_{t=1}^T\tau_tD_\psi(\theta_{t-1}\Vert\theta_t)\\ &\quad+\sum_{t=1}^TD_{\mathrm{KL}}\!\left( f_{\theta_{t-1}}(Y\mid x_t)\Vert f_{\theta_*}(Y\mid x_t)\right)\\ &\quad-\tau_TD_\phi(\eta_T\Vert\eta_*). \end{aligned}

This is an identity, not by itself a sublinear regret bound. The posterior KL sum is nonnegative and need not be small. It disappears for fully observed data. The penalty belongs to the comparator in (6); the sequential algorithm need not find its minimizer.

To verify the identity, let gt(θ)=ψ(θ)θ,tˉtg_t(\theta)=\psi(\theta)-\langle\theta,\bar t_t\rangle. Parameter-independent carrier terms cancel in likelihood differences. The update gives tˉt=τtηtτt1ηt1\bar t_t=\tau_t\eta_t-\tau_{t-1}\eta_{t-1}, and Legendre duality gives

tgt(θt1)=tτtDϕ(ηtηt1)+τ0ϕ(η0)τTϕ(ηT),tgt(θ)+τ0Dψ(θθ0)=τ0ϕ(η0)τTϕ(ηT)+τTDϕ(ηTη).\begin{aligned} \sum_tg_t(\theta_{t-1}) &=\sum_t\tau_tD_\phi(\eta_t\Vert\eta_{t-1}) +\tau_0\phi(\eta_0)-\tau_T\phi(\eta_T),\\ \sum_tg_t(\theta_*)+\tau_0D_\psi(\theta_*\Vert\theta_0) &=\tau_0\phi(\eta_0)-\tau_T\phi(\eta_T) +\tau_TD_\phi(\eta_T\Vert\eta_*). \end{aligned}

Subtract these expressions. The observed-versus-complete likelihood identity adds the posterior KL sum, while Dϕ(ηtηt1)=Dψ(θt1θt)D_\phi(\eta_t\Vert\eta_{t-1})=D_\psi(\theta_{t-1}\Vert\theta_t) supplies (7). The calculation is algebraic and requires all displayed expectations and divergences to be finite.

Application to generalized hyperbolic mixtures

Use the GH model

X=μ+γY+YLZ,YGIG(p,a,b),ZNd(0,Id),YZ,LL=Σ.X=\mu+\gamma Y+\sqrt Y\,LZ,\qquad Y\sim\operatorname{GIG}(p,a,b),\quad Z\sim\mathcal N_d(0,I_d), \quad Y\perp Z,\quad LL^\top=\Sigma.

The classical tuple is ϑ=(μ,γ,Σ,p,a,b)\vartheta=(\mu,\gamma,\Sigma,p,a,b); θ\theta denotes natural coordinates. In the scalar conditioning note, W=YW=Y, β=γ\beta=\gamma, and σ2=Σ\sigma^2=\Sigma. For a,b>0a,b>0 and positive-definite Σ\Sigma, the posterior is GIG and its power moments are finite. Set ut=E[Y1xt]u_t=\mathbb E[Y^{-1}\mid x_t], vt=E[Yxt]v_t=\mathbb E[Y\mid x_t], and lt=E[logYxt]l_t=\mathbb E[\log Y\mid x_t], evaluated at ϑt1\vartheta_{t-1}. In the Batch 1 statistic order,

tˉt=(lt,ut,vt,xt,xtut,xtxtut),ηt=(1ρt)ηt1+ρttˉt.\bar t_t=(l_t,u_t,v_t,x_t,x_tu_t,x_tx_t^\top u_t),\qquad \eta_t=(1-\rho_t)\eta_{t-1}+\rho_t\bar t_t.

The first three slots are (logY,Y1,Y)(\log Y,Y^{-1},Y), a permutation of the source online note’s (Y1,Y,logY)(Y^{-1},Y,\log Y). The normal parameters are recovered as

μt=η4,tη3,tη5,t1η2,tη3,t,γt=η5,tη2,tη4,t1η2,tη3,t,Σt=η6,tη5,tμtμtη5,t+η2,tμtμtη3,tγtγt.\begin{aligned} \mu_t&=\frac{\eta_{4,t}-\eta_{3,t}\eta_{5,t}} {1-\eta_{2,t}\eta_{3,t}},\\ \gamma_t&=\frac{\eta_{5,t}-\eta_{2,t}\eta_{4,t}} {1-\eta_{2,t}\eta_{3,t}},\\ \Sigma_t&=\eta_{6,t}-\eta_{5,t}\mu_t^\top-\mu_t\eta_{5,t}^\top +\eta_{2,t}\mu_t\mu_t^\top-\eta_{3,t}\gamma_t\gamma_t^\top. \end{aligned}

The mixing-law update maximizes LGIG(p,a,bη1,t,η2,t,η3,t)L_{\mathrm{GIG}}(p,a,b\mid\eta_{1,t},\eta_{2,t},\eta_{3,t}). These are the batch M-step formulas applied to running statistics. Their feasibility, nonzero-denominator, and positive-definiteness requirements still apply; boundary mixing laws need their own moment checks. A shrinkage target can regularize the statistics, but changes the update and its objective.

Curved families need a constrained M-step

For f(x,y;u)=h(x,y)exp{θ(u),t(x,y)ψ(θ(u))}f(x,y;u)=h(x,y)\exp\{\langle\theta(u),t(x,y)\rangle-\psi(\theta(u))\}, the ambient expectation vector need not equal the statistics being averaged. The appropriate map is

utarg maxu{θ(u),ηtψ(θ(u))}.u_t\in\operatorname*{arg\,max}_u \{\langle\theta(u),\eta_t\rangle-\psi(\theta(u))\}.

At an interior stationary point it satisfies

Dθ(ut)[ηtψ(θ(ut))]=0.D\theta(u_t)^\top[\eta_t-\nabla\psi(\theta(u_t))]=0.

This is weaker than ambient moment matching. Applying ϕ\nabla\phi without the constraint can leave the curved family. This limitation concerns that unconstrained inverse map: it does not exclude online EM for curved families. The Cappé–Moulines construction uses a model-specific maximizing map. Its convergence assumptions must be checked for the particular model; the full-family regret derivation above does not transfer automatically.

GH factor analysis gives a concrete constrained example. The EM update framework separates statistic aggregation, update rules, and parameter recovery. Numerical backends and runnable streaming examples stay in the upstream EM framework.

Source and adaptation

Adapted from xshi19/normix, docs/theory/online_em.md, at revision 763bb3608920661a012cf089888d349fbf680aad (2026-09-13 import). Copyright (c) 2020 xshi19. Licensed under MIT. The pinned source records the original version. Notation, mathematical qualifications, and links were adapted for this site. Package interfaces, fitter recipes, and executable cells are omitted; no upstream benchmark or formal-proof verification is claimed.

MIT permission notice

MIT License

Copyright (c) 2020 xshi19

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

References
  1. Cappé, O., & Moulines, E. (2009). On-Line Expectation–Maximization Algorithm for latent Data Models. Journal of the Royal Statistical Society Series B: Statistical Methodology, 71(3), 593–613. 10.1111/j.1467-9868.2009.00698.x