Information Geometry

Twelve ideas from information geometry, from divergences and dual coordinates to the EM algorithm, natural gradient learning and ICA. Drag distributions around the probability simplex and the Gaussian half-plane, run small learning algorithms, work through an example one step at a time, then check yourself.

Follows the chapter order of S. Amari, Information Geometry and Its Applications, Applied Mathematical Sciences 194 (Springer, 2016). Chapters 1–9 and 11–13 each get a module; Chapter 10 (linear systems and time series) is not covered. Chapter numbers refer to that book; the questions and examples here are written for this page.

InteractiveAmari, Ch. 1: Manifold, Divergence and Dually Flat Structure

Divergences and Legendre duality

A divergence measures how different two points are without having to be symmetric. Any strictly convex function produces one, and its Legendre transform produces a second coordinate system in which the same divergence reappears with its arguments swapped. This pair of coordinates is the backbone of the whole subject.

The idea

Divergence. A smooth function D[ξ:ξ′]D[\xi:\xi'] of two points with D≥0D\ge 0, equality only when ξ=ξ′\xi=\xi', and, for nearby points,
D[ξ:ξ+dξ]=12∑i,jgij(ξ)dξidξj+O(|dξ|3)D[\xi:\xi+d\xi] = \tfrac12 \sum_{i,j} g_{ij}(\xi)\, d\xi^i d\xi^j + O(|d\xi|^3)
with gg positive definite. Symmetry and the triangle inequality are not required. The matrix gg is a Riemannian metric.
Bregman divergence. For a smooth, strictly convex ψ\psi on a convex domain,
Dψ[θ:θ′]=ψ(θ)−ψ(θ′)−∇ψ(θ′)⋅(θ−θ′),D_\psi[\theta:\theta'] = \psi(\theta)-\psi(\theta')-\nabla\psi(\theta')\cdot(\theta-\theta'),
the height of the graph of ψ\psi at θ\theta above the tangent plane at θ′\theta'. Its metric is the Hessian, gij=∂i∂jψg_{ij}=\partial_i\partial_j\psi.
Legendre transform. Put η=∇ψ(θ)\eta=\nabla\psi(\theta). Strict convexity makes θ↦η\theta\mapsto\eta one-to-one, and
ψ*(η)=supθ⁡(θ⋅η−ψ(θ))=θ⋅η−ψ(θ),θ=∇ψ*(η).\psi^*(\eta) = \sup_{\theta}\big(\theta\cdot\eta-\psi(\theta)\big) = \theta\cdot\eta-\psi(\theta), \qquad \theta = \nabla\psi^*(\eta).
ψ*\psi^* is again convex, and its Hessian at η\eta is the inverse of the Hessian of ψ\psi at θ\theta.
Duality. For any θ\theta and η′=∇ψ(θ′)\eta'=\nabla\psi(\theta'),
Dψ[θ:θ′]=ψ(θ)+ψ*(η′)−θ⋅η′=Dψ*[η′:η].D_\psi[\theta:\theta'] = \psi(\theta)+\psi^*(\eta')-\theta\cdot\eta' = D_{\psi^*}[\eta':\eta].
The same number is a gap under ψ\psi and a gap under ψ*\psi^*, with the order of the points reversed.

So a convex function gives two coordinate systems, θ\theta and η\eta, and a divergence that looks like "half a squared distance" up close. The rest of Chapter 1 shows that straight lines in θ\theta and straight lines in η\eta behave like two kinds of geodesic, and a Pythagorean theorem holds when they meet at a right angle. Below, the left plot is ψ\psi and the right plot is ψ*\psi^*.

Explore

Convex function ψ(θ)
ψ(θ)\psi(\theta). Drag the points θ\theta and θ′\theta' sideways. Dψ[θ:θ′]D_\psi[\theta:\theta'] Dψ[θ′:θ]D_\psi[\theta':\theta]
ψ*(η)\psi^*(\eta), the same two points in the dual coordinate η=ψ′(θ)\eta=\psi'(\theta). You can drag here too.

Worked example

Take ψ(θ)=eθ\psi(\theta)=e^\theta on ℝ\R. Find the dual coordinate and the dual function, write DψD_\psi in terms of λ=eθ\lambda=e^\theta, and compute both orders for λ=1, λ′=2\lambda=1,\ \lambda'=2.

  1. What are η\eta and ψ*(η)\psi^*(\eta)?

    η=ψ′(θ)=eθ=λ\eta=\psi'(\theta)=e^\theta=\lambda, so η>0\eta>0 and θ=log⁡η\theta=\log\eta. Then

    ψ*(η)=θη−ψ(θ)=ηlog⁡η−η.\psi^*(\eta)=\theta\eta-\psi(\theta)=\eta\log\eta-\eta.
  2. Write Dψ[θ:θ′]D_\psi[\theta:\theta'] in terms of λ,λ′\lambda,\lambda'.

    Dψ[θ:θ′]=eθ−eθ′−eθ′(θ−θ′)=λ−λ′+λ′log⁡λ′λ.D_\psi[\theta:\theta'] = e^\theta-e^{\theta'}-e^{\theta'}(\theta-\theta') = \lambda-\lambda'+\lambda'\log\frac{\lambda'}{\lambda}.

    This is the KL divergence from the Poisson distribution with mean λ′\lambda' to the one with mean λ\lambda. (eθe^\theta is the log-partition function of the Poisson family, which is why the explorer labels it that way.)

  3. Check the duality formula using ψ*\psi^*.

    Dψ*[λ′:λ]=ψ*(λ′)−ψ*(λ)−(log⁡λ)(λ′−λ)=λ′log⁡λ′−λ′−λlog⁡λ+λ−λ′log⁡λ+λlog⁡λ,D_{\psi^*}[\lambda':\lambda] = \psi^*(\lambda')-\psi^*(\lambda)-(\log\lambda)(\lambda'-\lambda) = \lambda'\log\lambda'-\lambda'-\lambda\log\lambda+\lambda-\lambda'\log\lambda+\lambda\log\lambda,

    which simplifies to λ−λ′+λ′log⁡(λ′/λ)\lambda-\lambda'+\lambda'\log(\lambda'/\lambda), the same expression.

  4. Evaluate both orders for λ=1,λ′=2\lambda=1,\lambda'=2.

    Dψ[θ:θ′]=1−2+2log⁡2≈0.386D_\psi[\theta:\theta'] = 1-2+2\log2\approx 0.386 and Dψ[θ′:θ]=2−1+1⋅log⁡12≈0.307D_\psi[\theta':\theta]=2-1+1\cdot\log\tfrac12\approx 0.307. The two orders differ. Choose eθe^\theta in the explorer: it starts at θ=0\theta=0, θ′=log⁡2≈0.69\theta'=\log 2\approx0.69, and shows both gaps.

Check your understanding

For ψ(θ)=12|θ|2\psi(\theta)=\tfrac12|\theta|^2 on ℝn\R^n, what is Dψ[θ:θ′]D_\psi[\theta:\theta']?

  1. 12|θ−θ′|2\tfrac12|\theta-\theta'|^2
  2. |θ−θ′||\theta-\theta'|A divergence behaves like half a squared distance near the diagonal, not like a distance. Expand the definition.
  3. θ⋅θ′\theta\cdot\theta'That can be negative, and a divergence never is.
12|θ|2−12|θ′|2−θ′⋅(θ−θ′)=12|θ−θ′|2\tfrac12|\theta|^2-\tfrac12|\theta'|^2-\theta'\cdot(\theta-\theta') = \tfrac12|\theta-\theta'|^2. Here η=θ\eta=\theta and ψ*=ψ\psi^*=\psi: the Euclidean case is self-dual, which is why its divergence is symmetric.

Which property does a Bregman divergence fail to have in general?

  1. Dψ[θ:θ′]≥0D_\psi[\theta:\theta']\ge 0That always holds: a convex function lies above each of its tangent planes.
  2. Convexity in the first argument θ\thetaAs a function of θ\theta it is ψ\psi minus an affine function, so it is convex.
  3. Symmetry, Dψ[θ:θ′]=Dψ[θ′:θ]D_\psi[\theta:\theta']=D_\psi[\theta':\theta]
The gap at θ\theta under the tangent at θ′\theta' and the gap at θ′\theta' under the tangent at θ\theta are different lengths unless ψ\psi curves the same way everywhere between them. In the explorer the red and gold gaps differ for every ψ\psi except θ2/2\theta^2/2. It is also usually not convex in its second argument.

ψ\psi has second derivative ψ′′(θ)=g\psi''(\theta)=g at some θ\theta. What is (ψ*)′′(\psi^*)'' at η=ψ′(θ)\eta=\psi'(\theta)?

  1. 1/g1/g
  2. ggTest it on ψ=eθ\psi=e^\theta: ψ′′=eθ=η\psi''=e^\theta=\eta, while ψ*=ηlog⁡η−η\psi^*=\eta\log\eta-\eta has (ψ*)′′=1/η(\psi^*)''=1/\eta.
  3. −g-gψ*\psi^* is a supremum of affine functions of η\eta, so it is convex too.
(ψ*)′(η)=θ(η)(\psi^*)'(\eta)=\theta(\eta) is the inverse function of η(θ)=ψ′(θ)\eta(\theta)=\psi'(\theta), so its derivative is 1/ψ′′(θ)1/\psi''(\theta). In several variables the Hessians are inverse matrices: the metric written in η\eta-coordinates is the inverse of the metric in θ\theta-coordinates.

Practice

The Bernoulli potentialA Legendre pair and a KL divergence

Let ψ(θ)=log⁡(1+eθ)\psi(\theta)=\log(1+e^\theta). Find η\eta and ψ*(η)\psi^*(\eta), and show that Dψ[θ:θ′]D_\psi[\theta:\theta'] is the KL divergence ∑xp′(x)log⁡p′(x)p(x)\sum_x p'(x)\log\frac{p'(x)}{p(x)} between the Bernoulli distributions with success probabilities η′\eta' and η\eta.

Hint

η\eta is the logistic function of θ\theta, and ψ*\psi^* turns out to be minus an entropy. Use ψ*\psi^* and the duality formula rather than ψ\psi directly.

Solution

η=eθ/(1+eθ)\eta=e^\theta/(1+e^\theta), so θ=log⁡η1−η\theta=\log\frac{\eta}{1-\eta} and ψ(θ)=−log⁡(1−η)\psi(\theta)=-\log(1-\eta). Then ψ*(η)=θη−ψ=ηlog⁡η+(1−η)log⁡(1−η)\psi^*(\eta)=\theta\eta-\psi=\eta\log\eta+(1-\eta)\log(1-\eta). By duality

Dψ[θ:θ′]=ψ(θ)+ψ*(η′)−θη′=−log⁡(1−η)+η′log⁡η′+(1−η′)log⁡(1−η′)−η′log⁡η1−η,D_\psi[\theta:\theta'] = \psi(\theta)+\psi^*(\eta')-\theta\eta' = -\log(1-\eta)+\eta'\log\eta'+(1-\eta')\log(1-\eta')-\eta'\log\tfrac{\eta}{1-\eta},

which rearranges to η′log⁡η′η+(1−η′)log⁡1−η′1−η\eta'\log\frac{\eta'}{\eta}+(1-\eta')\log\frac{1-\eta'}{1-\eta}.

The three-point identityWhere the Pythagorean theorem comes from

Writing η=∇ψ(θ)\eta=\nabla\psi(\theta) and similarly for primed points, show that for any three points

Dψ[θ:θ′′]=Dψ[θ:θ′]+Dψ[θ′:θ′′]−(θ−θ′)⋅(η′′−η′).D_\psi[\theta:\theta''] = D_\psi[\theta:\theta'] + D_\psi[\theta':\theta''] - (\theta-\theta')\cdot(\eta''-\eta').

When does the last term vanish?

Solution

Expand all three divergences with the definition. The ψ(θ′)\psi(\theta') terms cancel, and collecting the inner products leaves exactly −(θ−θ′)⋅(η′′−η′)-(\theta-\theta')\cdot(\eta''-\eta'). It vanishes when the vector from θ′\theta' to θ\theta, written in θ\theta-coordinates, is orthogonal to the vector from θ′\theta' to θ′′\theta'', written in η\eta-coordinates. Because θ\theta and η\eta are dual, this pairing is the Riemannian inner product at θ′\theta'. That is the generalized Pythagorean theorem.

InteractiveAmari, Ch. 2: Exponential Families and Mixture Families of Probability Distributions

Exponential and mixture families

There are two natural ways to interpolate between distributions: mix them, or mix their logarithms. These are the two kinds of straight line in information geometry, the m-geodesic and the e-geodesic. When one meets the other at a right angle, KL divergences add like squared lengths.

The idea

Exponential family. p(x,θ)=exp⁡(θ⋅t(x)−ψ(θ))p(x,\theta)=\exp\big(\theta\cdot t(x)-\psi(\theta)\big) with respect to a fixed base measure. The log-partition function ψ\psi is convex, η=∇ψ(θ)=𝔼θ[t(x)]\eta=\nabla\psi(\theta)=\mathbb E_\theta[t(x)], and ∇2ψ(θ)=Covθ[t(x)]\nabla^2\psi(\theta)=\mathrm{Cov}_\theta[t(x)] is the Fisher information. So Module 1 applies with ψ\psi the log-partition function, and its Bregman divergence is a KL divergence: Dψ[θ:θ′]=KL[pθ′:pθ]D_\psi[\theta:\theta']=\mathrm{KL}[p_{\theta'}:p_\theta], where KL[p:q]=∑xp(x)log⁡p(x)q(x)\mathrm{KL}[p:q]=\sum_x p(x)\log\frac{p(x)}{q(x)}.
Mixture family. p(x,η)=∑iηipi(x)+(1−∑iηi)p0(x)p(x,\eta)=\sum_i \eta_i\, p_i(x)+\big(1-\sum_i\eta_i\big)p_0(x): linear in its parameters. The distributions on n+1n+1 outcomes, the simplex SnS_n, are both: θi=log⁡(pi/p0)\theta^i=\log(p_i/p_0) makes it exponential and ηi=pi\eta_i=p_i makes it a mixture family.
Two geodesics. Between pp and qq, the m-geodesic is pt=(1−t)p+tqp_t=(1-t)p+tq. The e-geodesic is log⁡pt=(1−t)log⁡p+tlog⁡q−c(t)\log p_t=(1-t)\log p+t\log q-c(t), that is pt∝p1−tqtp_t\propto p^{1-t}q^t. A set of distributions is m-flat if it contains the m-geodesic between any two of its points, and e-flat for e-geodesics.
Pythagorean theorem. If the m-geodesic from PP to QQ and the e-geodesic from QQ to RR are orthogonal at QQ in the Fisher metric, then
KL[P:R]=KL[P:Q]+KL[Q:R].\mathrm{KL}[P:R]=\mathrm{KL}[P:Q]+\mathrm{KL}[Q:R].
Projection theorem. Let MM be m-flat and RR any distribution. The point Q∈MQ\in M minimizing KL[Q:R]\mathrm{KL}[Q:R] is unique, and it is where an e-geodesic from RR meets MM orthogonally (the e-projection). For every P∈MP\in M, KL[P:R]=KL[P:Q]+KL[Q:R]\mathrm{KL}[P:R]=\mathrm{KL}[P:Q]+\mathrm{KL}[Q:R].

The maximum entropy principle is the special case where RR is uniform: KL[Q:u]=log⁡(n+1)−H(Q)\mathrm{KL}[Q:u]=\log(n+1)-H(Q), so maximizing entropy under linear constraints is e-projecting the uniform distribution, and the answer has exponential form.

Explore

The simplex of distributions on three outcomes; each corner is a certain outcome. m-geodesic e-geodesic
Show

Worked example

Find the distribution on {0,1,2}\{0,1,2\} with mean 10/710/7 that has the largest entropy, and check the Pythagorean relation for another distribution with the same mean.

  1. Before computing: what form must the answer have, and why?

    The distributions with mean 10/710/7 form an m-flat set MM (a linear constraint). Maximizing entropy over MM is e-projecting the uniform distribution uu onto MM, so the answer lies on an e-geodesic from uu that meets MM orthogonally. The e-geodesics through uu are qx∝eλv(x)q_x\propto e^{\lambda v(x)}, and orthogonality to every direction inside MM (changes δp\delta p with ∑δpx=0\sum\delta p_x=0 and ∑xδpx=0\sum x\,\delta p_x=0) forces vv to be affine in xx. So qx∝eλxq_x\propto e^{\lambda x}, that is, q=(1,r,r2)/(1+r+r2)q=(1,r,r^2)/(1+r+r^2) with r=eλr=e^\lambda.

  2. Solve for rr.

    The mean is r+2r21+r+r2=107\dfrac{r+2r^2}{1+r+r^2}=\dfrac{10}{7}, so 7r+14r2=10+10r+10r27r+14r^2=10+10r+10r^2, that is 4r2−3r−10=04r^2-3r-10=0, with positive root r=2r=2. Hence q=(1,2,4)/7q=(1,2,4)/7.

  3. Compute H(q)H(q).

    log⁡qx=xlog⁡2−log⁡7\log q_x = x\log2-\log7, so H(q)=log⁡7−107log⁡2≈0.956H(q)=\log7-\tfrac{10}{7}\log2\approx 0.956 nats (against log⁡3≈1.099\log 3\approx1.099 for the uniform distribution).

  4. Take p=(2/7,0,5/7)p=(2/7,\,0,\,5/7), which also has mean 10/710/7. Show KL[p:u]=KL[p:q]+KL[q:u]\mathrm{KL}[p:u]=\mathrm{KL}[p:q]+\mathrm{KL}[q:u].

    Since log⁡qx\log q_x is affine in xx, ∑xpxlog⁡qx\sum_x p_x\log q_x depends on pp only through its mean, so it equals ∑xqxlog⁡qx=−H(q)\sum_x q_x\log q_x=-H(q). Therefore KL[p:q]=−H(p)+H(q)\mathrm{KL}[p:q]=-H(p)+H(q), and

    KL[p:q]+KL[q:u]=(H(q)−H(p))+(log⁡3−H(q))=log⁡3−H(p)=KL[p:u].\mathrm{KL}[p:q]+\mathrm{KL}[q:u] = \big(H(q)-H(p)\big)+\big(\log3-H(q)\big) = \log 3-H(p)=\mathrm{KL}[p:u].

    Numerically H(p)≈0.598H(p)\approx0.598, so KL[p:q]≈0.357\mathrm{KL}[p:q]\approx0.357. The step "depends only through the mean" is exactly the orthogonality in the theorem.

Check your understanding

p=(0.8,0.1,0.1)p=(0.8,0.1,0.1) and q=(0.1,0.1,0.8)q=(0.1,0.1,0.8). Which is the midpoint of the e-geodesic between them?

  1. (0.45,0.10,0.45)(0.45,\,0.10,\,0.45)That is the m-midpoint, the average of the probabilities.
  2. (0.425,0.150,0.425)(0.425,\,0.150,\,0.425)
  3. (0.5,0,0.5)(0.5,\,0,\,0.5)An e-geodesic between distributions with full support never reaches the boundary.
The e-midpoint is the normalized geometric mean: pq=(0.283,0.1,0.283)\sqrt{pq}=(0.283,0.1,0.283), which sums to 0.6660.666; dividing gives (0.425,0.150,0.425)(0.425,0.150,0.425). The geometric mean punishes disagreement, so the outcome on which pp and qq agree gains weight.

QQ is the e-projection of RR onto an m-flat set MM, and PP is another point of MM. Which is guaranteed?

  1. KL[P:R]≥KL[Q:R]\mathrm{KL}[P:R]\ge\mathrm{KL}[Q:R], with equality only if P=QP=Q
  2. KL[R:P]≥KL[R:Q]\mathrm{KL}[R:P]\ge\mathrm{KL}[R:Q]The order matters. The e-projection minimizes KL[⋅:R]\mathrm{KL}[\,\cdot:R], with the point of MM first. Minimizing KL[R:⋅]\mathrm{KL}[R:\cdot\,] is a different projection.
  3. KL[P:Q]=KL[Q:P]\mathrm{KL}[P:Q]=\mathrm{KL}[Q:P]KL is not symmetric, even between points of a flat set.
Pythagoras gives KL[P:R]=KL[P:Q]+KL[Q:R]\mathrm{KL}[P:R]=\mathrm{KL}[P:Q]+\mathrm{KL}[Q:R] and KL[P:Q]>0\mathrm{KL}[P:Q]>0 for P≠QP\ne Q. That is why the e-projection is the unique minimizer. Switch the explorer to "Projection" and slide PP along the line.

Which of these sets of distributions on three outcomes is both e-flat and m-flat?

  1. {p:p1=2p3}\{p : p_1 = 2p_3\}
  2. {p:p1−p3=0.2}\{p : p_1-p_3 = 0.2\}It is linear in pp, so m-flat. But the e-midpoint of (0.5,0.2,0.3)(0.5,0.2,0.3) and (0.3,0.6,0.1)(0.3,0.6,0.1) has p1−p3≈0.236p_1-p_3\approx0.236.
  3. {p:p1p3=p22}\{p : p_1p_3 = p_2^2\}In logarithms it reads log⁡p1+log⁡p3−2log⁡p2=0\log p_1+\log p_3-2\log p_2=0, which is linear in θ\theta, so it is e-flat. Is the m-midpoint of (13,13,13)(\tfrac13,\tfrac13,\tfrac13) and (47,27,17)(\tfrac47,\tfrac27,\tfrac17) in it?
p1=2p3p_1=2p_3 is linear in pp (m-flat), and it is equivalent to log⁡p1−log⁡p3=log⁡2\log p_1-\log p_3=\log2, which is linear in θi=log⁡(pi/p0)\theta^i=\log(p_i/p_0) (e-flat). In the simplex picture it is a straight line through a corner.

Practice

The Bernoulli familyNatural and expectation coordinates

Write the Bernoulli distribution p(x)=ηx(1−η)1−xp(x)=\eta^x(1-\eta)^{1-x}, x∈{0,1}x\in\{0,1\}, as an exponential family. Find θ\theta, ψ(θ)\psi(\theta), and the Fisher information in the coordinate θ\theta and in the coordinate η\eta.

Solution

log⁡p=xlog⁡η1−η+log⁡(1−η)\log p = x\log\frac{\eta}{1-\eta}+\log(1-\eta), so t(x)=xt(x)=x, θ=log⁡η1−η\theta=\log\frac{\eta}{1-\eta} and ψ(θ)=log⁡(1+eθ)\psi(\theta)=\log(1+e^\theta). In θ\theta: g=ψ′′(θ)=η(1−η)g=\psi''(\theta)=\eta(1-\eta), the variance of xx. In η\eta: g=1/(η(1−η))g=1/(\eta(1-\eta)), the inverse, as Module 1 predicts.

Mutual information as a projectionProjecting onto independent distributions

Let p(x,y)p(x,y) be a joint distribution on a finite set, with marginals pX,pYp_X,p_Y. Show that among all product distributions q1(x)q2(y)q_1(x)q_2(y) (an e-flat set), KL[p:q1q2]\mathrm{KL}[p:q_1q_2] is minimized by q1=pX, q2=pYq_1=p_X,\ q_2=p_Y, and the minimum is the mutual information I(X;Y)I(X;Y).

Hint

Split log⁡q1(x)q2(y)\log q_1(x)q_2(y) into its two terms and sum out the other variable in each.

Solution

KL[p:q1q2]=−H(X,Y)−∑xpX(x)log⁡q1(x)−∑ypY(y)log⁡q2(y)\mathrm{KL}[p:q_1q_2]=-H(X,Y)-\sum_x p_X(x)\log q_1(x)-\sum_y p_Y(y)\log q_2(y) =−H(X,Y)+H(X)+KL[pX:q1]+H(Y)+KL[pY:q2]= -H(X,Y)+H(X)+\mathrm{KL}[p_X:q_1]+H(Y)+\mathrm{KL}[p_Y:q_2]. The two KL terms vanish exactly when q1=pXq_1=p_X, q2=pYq_2=p_Y, leaving H(X)+H(Y)−H(X,Y)=I(X;Y)H(X)+H(Y)-H(X,Y)=I(X;Y). Here the second argument is projected onto an e-flat set (an m-projection), the dual of the explorer's situation.

InteractiveAmari, Ch. 3: Invariant Geometry of Manifold of Probability Distributions

Invariance and the Fisher metric

How should we measure the difference between two distributions? Ask only that merging outcomes can never make them easier to tell apart, and that a merge which loses no information changes nothing. Those two demands single out the f-divergences, and they force the metric to be the Fisher metric, up to a constant factor.

The idea

f-divergence. For a convex ff on (0,∞)(0,\infty) with f(1)=0f(1)=0 and f′′(1)=1f''(1)=1,
Df[p:q]=∑ipif(qipi).D_f[p:q]=\sum_i p_i\, f\!\left(\frac{q_i}{p_i}\right).
f(u)=−log⁡uf(u)=-\log u gives KL[p:q]\mathrm{KL}[p:q]; f(u)=ulog⁡uf(u)=u\log u gives KL[q:p]\mathrm{KL}[q:p]; f(u)=2(u−1)2f(u)=2(\sqrt u-1)^2 gives 2∑i(pi−qi)22\sum_i(\sqrt{p_i}-\sqrt{q_i})^2.
Coarse graining. Merge the outcomes into blocks A1,…,AmA_1,\dots,A_m: p‾j=∑i∈Ajpi\bar p_j=\sum_{i\in A_j}p_i. The merge is sufficient for p,qp,q if qi/piq_i/p_i is constant on each block: then nothing that distinguishes pp from qq is lost.
Information monotonicity. Df[p‾:q‾]≤Df[p:q]D_f[\bar p:\bar q]\le D_f[p:q] for every coarse graining, with equality when it is sufficient. (Jensen's inequality inside each block.)
Uniqueness. On three or more outcomes, a divergence of the form ∑iF(pi,qi)\sum_i F(p_i,q_i) that is monotone in this sense is an f-divergence (up to a constant factor). A Riemannian metric on SnS_n that is invariant under sufficient embeddings is a constant multiple of the Fisher metric
gij(ξ)=𝔼ξ[∂ilog⁡p(x,ξ) ∂jlog⁡p(x,ξ)],ds2=∑idpi2pi  on Sn.g_{ij}(\xi)=\mathbb E_\xi\big[\partial_i\log p(x,\xi)\ \partial_j\log p(x,\xi)\big], \qquad ds^2=\sum_i\frac{dp_i^2}{p_i}\ \text{ on } S_n.

Every f-divergence with f′′(1)=1f''(1)=1 has this same metric, Df[p:p+dp]≈12∑idpi2/piD_f[p:p+dp]\approx\tfrac12\sum_i dp_i^2/p_i. The substitution ξi=2pi\xi_i=2\sqrt{p_i} turns ds2ds^2 into ∑dξi2\sum d\xi_i^2 and SnS_n into part of a sphere of radius 2, so the Fisher distance is d(p,q)=2arccos⁡∑ipiqid(p,q)=2\arccos\sum_i\sqrt{p_iq_i}. Below, compare the level sets of KL[P:⋅]\mathrm{KL}[P:\cdot\,], KL[⋅:P]\mathrm{KL}[\,\cdot:P] and 12d2\tfrac12 d^2: they agree near PP and part company further away.

Explore

Drag P and Q. Curves are the levels 0.01, 0.03, 0.08, 0.18, 0.35, 0.7, 1.4 of the chosen divergence from P.
Level sets of

Worked example

Let p=(0.5,0.3,0.2)p=(0.5,0.3,0.2) and q=(0.2,0.3,0.5)q=(0.2,0.3,0.5). Merge outcomes 2 and 3 and compare KL divergences before and after; then change qq so that the merge loses nothing.

  1. Compute KL[p:q]\mathrm{KL}[p:q].

    0.5log⁡2.5+0.3log⁡1+0.2log⁡0.4≈0.458+0−0.183=0.2750.5\log2.5+0.3\log1+0.2\log0.4\approx0.458+0-0.183=0.275.

  2. Compute KL[p‾:q‾]\mathrm{KL}[\bar p:\bar q] for p‾=(0.5,0.5)\bar p=(0.5,0.5), q‾=(0.2,0.8)\bar q=(0.2,0.8).

    0.5log⁡2.5+0.5log⁡0.625≈0.458−0.235=0.2230.5\log2.5+0.5\log0.625\approx0.458-0.235=0.223. Smaller, as monotonicity demands.

  3. Where exactly is the loss? Use the ratios qi/piq_i/p_i.

    On the merged block the ratios are q2/p2=1q_2/p_2=1 and q3/p3=2.5q_3/p_3=2.5. They differ, so the merged block mixes evidence that pointed in different directions. The loss is p‾2\bar p_2 times a KL divergence of the within-block conditionals: 0.5KL[(0.6,0.4):(0.375,0.625)]≈0.0520.5\,\mathrm{KL}[(0.6,0.4):(0.375,0.625)]\approx0.052, and indeed 0.275−0.223=0.0520.275-0.223=0.052.

  4. Keep q1=0.2q_1=0.2 and choose q2,q3q_2,q_3 so the merge is sufficient. What is KL[p:q]\mathrm{KL}[p:q] now?

    We need q2/q3=p2/p3=3/2q_2/q_3=p_2/p_3=3/2 with q2+q3=0.8q_2+q_3=0.8, so q=(0.2,0.48,0.32)q=(0.2,0.48,0.32). Then KL[p:q]=0.5log⁡2.5+0.3log⁡0.625+0.2log⁡0.625≈0.223\mathrm{KL}[p:q]=0.5\log2.5+0.3\log0.625+0.2\log0.625\approx0.223, equal to the merged value. The "Make the merge sufficient" button does this to Q.

Check your understanding

Which of these is not an f-divergence on the simplex?

  1. KL[q:p]\mathrm{KL}[q:p]Take f(u)=ulog⁡uf(u)=u\log u: ∑piqipilog⁡qipi=∑qilog⁡qipi\sum p_i\frac{q_i}{p_i}\log\frac{q_i}{p_i}=\sum q_i\log\frac{q_i}{p_i}.
  2. 2∑i(pi−qi)22\sum_i(\sqrt{p_i}-\sqrt{q_i})^2Take f(u)=2(u−1)2f(u)=2(\sqrt u-1)^2.
  3. ∑i(pi−qi)2\sum_i(p_i-q_i)^2
Split one outcome into kk equally likely copies. That refinement is sufficient, so an invariant divergence must not change. But the squared Euclidean distance replaces (a−b)2(a-b)^2 by k(a/k−b/k)2=(a−b)2/kk(a/k-b/k)^2=(a-b)^2/k. An f-divergence depends only on the ratios qi/piq_i/p_i, which splitting leaves alone.

p=(0.4,0.4,0.2)p=(0.4,0.4,0.2). After merging outcomes 2 and 3, for which qq is KL[p:q]\mathrm{KL}[p:q] unchanged?

  1. q=(0.2,0.4,0.4)q=(0.2,0.4,0.4)The ratios on the merged block are 11 and 22: the merge throws away the difference between them.
  2. q=(0.1,0.6,0.3)q=(0.1,0.6,0.3)
  3. q=(0.4,0.2,0.4)q=(0.4,0.2,0.4)Ratios 0.50.5 and 22 on the merged block. Not sufficient.
Here q2/p2=q3/p3=1.5q_2/p_2=q_3/p_3=1.5, so within the merged block qq is just a rescaled copy of pp: the merged outcome carries the same evidence as the two separate ones. Equality in monotonicity is exactly this condition.

All f-divergences with f′′(1)=1f''(1)=1 agree with 12ds2\tfrac12ds^2 to second order. So when QQ is close to PP, how big is KL[P:Q]−KL[Q:P]\mathrm{KL}[P:Q]-\mathrm{KL}[Q:P]?

  1. Third order in the distance between them
  2. Second order, comparable to the divergences themselvesBoth orders have the same second-order term 12ds2\tfrac12 ds^2, so it cancels in the difference.
  3. Exactly zeroThe cubic terms differ. Drag Q close to P and watch the two KL readings: they agree to more and more digits, but not exactly.
The asymmetry of KL is a third-order effect: near the diagonal every invariant divergence looks like half the squared Fisher distance. (The third-order term is where the dual connections of Chapter 6 come from.)

Practice

Every f-divergence gives the Fisher metricA Taylor expansion

Show that Df[p:p+dp]=12f′′(1)∑idpi2/pi+O(|dp|3)D_f[p:p+dp]=\tfrac12 f''(1)\sum_i dp_i^2/p_i+O(|dp|^3) for pp and p+dpp+dp in the simplex.

Hint

Write qi/pi=1+uiq_i/p_i=1+u_i with ui=dpi/piu_i=dp_i/p_i, expand ff around 1, and use ∑idpi=0\sum_i dp_i=0.

Solution

f(1+u)=f′(1)u+12f′′(1)u2+O(u3)f(1+u)=f'(1)u+\tfrac12f''(1)u^2+O(u^3). Summing pif(1+ui)p_if(1+u_i): the linear term is f′(1)∑idpi=0f'(1)\sum_i dp_i=0, and the quadratic term is 12f′′(1)∑ipiui2=12f′′(1)∑idpi2/pi\tfrac12f''(1)\sum_i p_i u_i^2=\tfrac12 f''(1)\sum_i dp_i^2/p_i.

Fisher distance through the sphereA closed form

Show that ξi=2pi\xi_i=2\sqrt{p_i} sends the simplex into the sphere |ξ|=2|\xi|=2 and turns ∑dpi2/pi\sum dp_i^2/p_i into ∑dξi2\sum d\xi_i^2. Deduce d(p,q)=2arccos⁡∑ipiqid(p,q)=2\arccos\sum_i\sqrt{p_iq_i}, and evaluate it for p=(12,12)p=(\tfrac12,\tfrac12), q=(0.9,0.1)q=(0.9,0.1).

Solution

∑ξi2=4∑pi=4\sum\xi_i^2=4\sum p_i=4 and dξi=dpi/pid\xi_i=dp_i/\sqrt{p_i}, so dξi2=dpi2/pid\xi_i^2=dp_i^2/p_i. Distances on a sphere of radius 2 are 2×2\times(angle), and cos⁡(angle)=ξ⋅ξ′/4=∑piqi\cos(\text{angle})=\xi\cdot\xi'/4=\sum\sqrt{p_iq_i}. (The image is the positive part of the sphere, which contains the great-circle arc between any two of its points, so this is the distance within the simplex too.) Here ∑piqi=0.45+0.05≈0.894\sum\sqrt{p_iq_i}=\sqrt{0.45}+\sqrt{0.05}\approx0.894, so d≈2×0.464=0.927d\approx2\times0.464=0.927.

InteractiveAmari, Ch. 4: α-Geometry, Tsallis q-Entropy and Positive-Definite Matrices

α-divergences and α-geodesics

The m-geodesic averages probabilities; the e-geodesic averages their logarithms. Average their powers instead and you get a whole family of curves, means and divergences indexed by one number α\alpha, with α\alpha and −α-\alpha always dual to each other.

The idea

α-representation. ℓα(u)=21−αu(1−α)/2\ell_\alpha(u)=\dfrac{2}{1-\alpha}\,u^{(1-\alpha)/2} for α≠1\alpha\ne1, and ℓ1(u)=log⁡u\ell_1(u)=\log u. So α=−1\alpha=-1 is uu itself (m), α=1\alpha=1 is log⁡u\log u (e), and α=0\alpha=0 is 2u2\sqrt u.
α-divergence. For positive vectors m,nm,n and α≠±1\alpha\ne\pm1,
Dα[m:n]=41−α2∑i(1−α2mi+1+α2ni−mi(1−α)/2ni(1+α)/2).D_\alpha[m:n]=\frac{4}{1-\alpha^2}\sum_i\Big(\tfrac{1-\alpha}{2}m_i+\tfrac{1+\alpha}{2}n_i-m_i^{(1-\alpha)/2}\,n_i^{(1+\alpha)/2}\Big).
As α→−1\alpha\to-1 it tends to ∑i(milog⁡mini−mi+ni)\sum_i\big(m_i\log\frac{m_i}{n_i}-m_i+n_i\big), the KL divergence, and as α→1\alpha\to1 to the same with m,nm,n swapped. Always Dα[m:n]=D−α[n:m]D_\alpha[m:n]=D_{-\alpha}[n:m]. It is the f-divergence with f(u)=41−α2(1−u(1+α)/2)+21−α(u−1)f(u)=\frac{4}{1-\alpha^2}\big(1-u^{(1+\alpha)/2}\big)+\frac{2}{1-\alpha}(u-1).
α-geodesic. On positive measures it is the straight line in ℓα\ell_\alpha: mi(t)(1−α)/2=(1−t)mi(1−α)/2+tni(1−α)/2m_i(t)^{(1-\alpha)/2}=(1-t)\,m_i^{(1-\alpha)/2}+t\,n_i^{(1-\alpha)/2}. On the simplex, rescale p(t)p(t) to sum to 1. For α=0\alpha=0 this is the great-circle arc of Module 3.
Pythagoras, with a correction. Positive measures are α-flat for every α\alpha, and the Pythagorean theorem holds exactly there. The simplex is flat only for α=±1\alpha=\pm1. For other α\alpha, when the α-geodesic pqpq and the (−α)(-\alpha)-geodesic qrqr are orthogonal,
Dα[p:r]=Dα[p:q]+Dα[q:r]−1−α24Dα[p:q]Dα[q:r],D_\alpha[p:r]=D_\alpha[p:q]+D_\alpha[q:r]-\tfrac{1-\alpha^2}{4}\,D_\alpha[p:q]\,D_\alpha[q:r],
the spherical correction for a space of constant curvature.

The same exponents give the α-mean of positive numbers, mα(a,b)=ℓα−1(12ℓα(a)+12ℓα(b))m_\alpha(a,b)=\ell_\alpha^{-1}\big(\tfrac12\ell_\alpha(a)+\tfrac12\ell_\alpha(b)\big): arithmetic for α=−1\alpha=-1, geometric for α=1\alpha=1, harmonic for α=3\alpha=3. Tsallis's q-logarithm lnq⁡u=(u1−q−1)/(1−q)\ln_q u=(u^{1-q}-1)/(1-q) is the α-representation shifted by a constant, with q=(1+α)/2q=(1+\alpha)/2. The chapter also builds invariant divergences on positive-definite matrices (Practice below).

Explore

α-geodesic for reference, the m- and e-geodesics (α = −1, 1). Drag P and Q.
Jump to:

Worked example

Compute the α-mean of a=1a=1 and b=4b=4 for several α\alpha, and find its limits as α→±∞\alpha\to\pm\infty.

  1. Write mα(a,b)m_\alpha(a,b) explicitly for α≠1\alpha\ne1.

    With r=(1−α)/2r=(1-\alpha)/2, the constant 2/(1−α)2/(1-\alpha) cancels and mα(a,b)=(ar+br2)1/rm_\alpha(a,b)=\Big(\dfrac{a^r+b^r}{2}\Big)^{1/r}: a power mean with exponent rr.

  2. Evaluate it for α=−1,0,1,3\alpha=-1,0,1,3.

    α=−1\alpha=-1 (r=1r=1): 2.52.5. α=0\alpha=0 (r=12r=\tfrac12): (1+22)2=2.25\big(\tfrac{1+2}{2}\big)^2=2.25. α=1\alpha=1 (the limit r→0r\to0): 1⋅4=2\sqrt{1\cdot4}=2. α=3\alpha=3 (r=−1r=-1): (1+1/42)−1=1.6\big(\tfrac{1+1/4}{2}\big)^{-1}=1.6.

  3. What happens as α→−∞\alpha\to-\infty and α→+∞\alpha\to+\infty?

    r→+∞r\to+\infty: the power mean tends to max⁡(a,b)=4\max(a,b)=4. r→−∞r\to-\infty: it tends to min⁡(a,b)=1\min(a,b)=1. So α\alpha slides the mean continuously and monotonically from optimistic (max) to pessimistic (min).

  4. Connect this to the explorer.

    Before rescaling, the α-geodesic midpoint of PP and QQ is their α-mean taken coordinate by coordinate. For large α\alpha each coordinate is pulled toward the smaller of pi,qip_i,q_i, so after rescaling the midpoint gives more weight to outcomes on which PP and QQ agree. For very negative α\alpha the larger value wins and the midpoint spreads toward both of their favourite outcomes. Put PP and QQ near different corners and move α from −3 to 3.

Check your understanding

For which α\alpha is DαD_\alpha symmetric in its two arguments?

  1. α=0\alpha=0
  2. α=1\alpha=1D1[p:q]=KL[q:p]D_1[p:q]=\mathrm{KL}[q:p], which is not symmetric.
  3. Every α\alphaUse the duality Dα[p:q]=D−α[q:p]D_\alpha[p:q]=D_{-\alpha}[q:p]: symmetry needs Dα=D−αD_\alpha=D_{-\alpha}.
Duality gives Dα[p:q]=D−α[q:p]D_\alpha[p:q]=D_{-\alpha}[q:p], so D0D_0 is self-dual and symmetric. It equals 2∑(pi−qi)22\sum(\sqrt{p_i}-\sqrt{q_i})^2 on the simplex. Set α=0\alpha=0 above: the two readings coincide.

For which α\alpha does the plain Pythagorean relation Dα[p:r]=Dα[p:q]+Dα[q:r]D_\alpha[p:r]=D_\alpha[p:q]+D_\alpha[q:r] hold exactly on the simplex (under the orthogonality condition)?

  1. Only α=±1\alpha=\pm1
  2. Only α=0\alpha=0At α=0\alpha=0 the correction factor (1−α2)/4(1-\alpha^2)/4 is largest: the simplex is a piece of a sphere for that geometry.
  3. Every α\alphaThat is true for positive measures, which are α-flat for every α\alpha. The simplex is a curved slice of them.
The correction term carries the factor 1−α21-\alpha^2, which vanishes only at α=±1\alpha=\pm1: the e- and m-geometries, in which the simplex is dually flat.

As α\alpha increases from −1-1 to 11, the α-mean of 1 and 4…

  1. decreases from 2.5 to 2
  2. increases from 2 to 2.5α=−1\alpha=-1 is the arithmetic mean, the larger one.
  3. stays at 2.5Only when a=ba=b do all the means agree.
The exponent r=(1−α)/2r=(1-\alpha)/2 falls from 1 to 0, and power means increase with their exponent. On the way, α=0\alpha=0 gives 2.252.25.

Practice

α = 0 is a function of the Fisher distanceHellinger and the sphere

Show that on the simplex D0[p:q]=8sin2⁡(d/4)D_0[p:q]=8\sin^2(d/4), where d=2arccos⁡∑ipiqid=2\arccos\sum_i\sqrt{p_iq_i} is the Fisher distance.

Solution

For probability vectors the first two terms of D0D_0 sum to 1, so D0=4(1−∑piqi)=4(1−cos⁡(d/2))=8sin2⁡(d/4)D_0=4\big(1-\sum\sqrt{p_iq_i}\big)=4(1-\cos(d/2))=8\sin^2(d/4). So D0D_0 is an increasing function of the Fisher distance, and D0≈d2/2D_0\approx d^2/2 for small dd.

A divergence for covariance matricesInvariance under change of basis

On positive-definite n×nn\times n matrices take ψ(P)=−log⁡det⁡P\psi(P)=-\log\det P. Show that its Bregman divergence is D[P:Q]=tr(PQ−1)−log⁡det⁡(PQ−1)−nD[P:Q]=\mathrm{tr}(PQ^{-1})-\log\det(PQ^{-1})-n, that it is unchanged by P↦A𝖳PAP\mapsto A^{\mathsf T}PA, Q↦A𝖳QAQ\mapsto A^{\mathsf T}QA for invertible AA, and what it becomes for diagonal matrices.

Hint

The gradient of log⁡det⁡\log\det at QQ is Q−1Q^{-1}, in the sense dlog⁡det⁡Q=tr(Q−1dQ)d\log\det Q=\mathrm{tr}(Q^{-1}dQ).

Solution

D=−log⁡det⁡P+log⁡det⁡Q+tr(Q−1(P−Q))D=-\log\det P+\log\det Q+\mathrm{tr}\big(Q^{-1}(P-Q)\big), which is the stated formula. Under the change of basis PQ−1↦A𝖳PQ−1A−𝖳PQ^{-1}\mapsto A^{\mathsf T}PQ^{-1}A^{-\mathsf T}, a similar matrix, so trace and determinant are unchanged. For diagonal matrices it is ∑i(pi/qi−log⁡(pi/qi)−1)\sum_i\big(p_i/q_i-\log(p_i/q_i)-1\big), a sum of Itakura–Saito divergences. It is also twice the KL divergence between the zero-mean Gaussians with covariances PP and QQ.

InteractiveAmari, Ch. 5: Elements of Differential Geometry

The Fisher metric on Gaussians

The normal distributions N(μ,σ2)N(\mu,\sigma^2) form a surface, the upper half-plane. With the Fisher metric it is a hyperbolic plane: distances blow up as σ→0\sigma\to0, and the shortest path between two narrow distributions with different means goes through wider ones.

The idea

Riemannian metric. An inner product gij(ξ)g_{ij}(\xi) on each tangent space. A curve ξ(t)\xi(t) has length ∫gijξ˙iξ˙jdt\int\sqrt{g_{ij}\dot\xi^i\dot\xi^j}\,dt, and the distance between points is the infimum of lengths. The length of a curve does not depend on the coordinates used to describe it.
Connection and geodesics. An affine connection says how to compare tangent vectors at nearby points (covariant derivative, parallel transport). A geodesic is a curve whose velocity is parallel along itself. The Levi-Civita connection is the unique torsion-free connection that preserves gg; its geodesics are locally the shortest curves. Curvature measures how parallel transport around a small loop rotates vectors.
The normal family. For N(μ,σ2)N(\mu,\sigma^2) the Fisher metric is
ds2=dμ2+2dσ2σ2.ds^2=\frac{d\mu^2+2\,d\sigma^2}{\sigma^2}.
With u=μ/2u=\mu/\sqrt2 this is 2(du2+dσ2)/σ22\,(du^2+d\sigma^2)/\sigma^2: twice the Poincaré half-plane metric, a surface of constant curvature −12-\tfrac12.

So geodesics are the hyperbolic ones: vertical lines, and half-circles centred on σ=0\sigma=0 in the (u,σ)(u,\sigma) plane, which are half-ellipses (μ−c)2/2+σ2=R2(\mu-c)^2/2+\sigma^2=R^2 in (μ,σ)(\mu,\sigma). The distance is

d=2arccosh⁡(1+(μ1−μ2)2/2+(σ1−σ2)22σ1σ2).d=\sqrt2\,\operatorname{arccosh}\!\Big(1+\frac{(\mu_1-\mu_2)^2/2+(\sigma_1-\sigma_2)^2}{2\sigma_1\sigma_2}\Big).

Explore

The (μ,σ)(\mu,\sigma) half-plane. geodesic, with dots at equal Fisher spacing straight segment. Small ellipses are Fisher circles of equal radius. Drag A and B.
The densities of A (blue), B (gold) and the evenly spaced distributions along the geodesic.

Worked example

Derive the Fisher metric of N(μ,σ2)N(\mu,\sigma^2), then find the Fisher distance from N(−1,1)N(-1,1) to N(1,1)N(1,1) and compare it with the path that keeps σ=1\sigma=1.

  1. Compute the two score functions.

    log⁡p=−log⁡σ−(x−μ)22σ2+const\log p=-\log\sigma-\frac{(x-\mu)^2}{2\sigma^2}+\text{const}. With z=(x−μ)/σz=(x-\mu)/\sigma, ∂μlog⁡p=z/σ\partial_\mu\log p=z/\sigma and ∂σlog⁡p=(z2−1)/σ\partial_\sigma\log p=(z^2-1)/\sigma.

  2. Take expectations of their products.

    zz is standard normal: 𝔼z2=1\mathbb E z^2=1, 𝔼z(z2−1)=0\mathbb E z(z^2-1)=0, 𝔼(z2−1)2=𝔼z4−2𝔼z2+1=2\mathbb E(z^2-1)^2=\mathbb Ez^4-2\mathbb Ez^2+1=2. So gμμ=1/σ2g_{\mu\mu}=1/\sigma^2, gμσ=0g_{\mu\sigma}=0, gσσ=2/σ2g_{\sigma\sigma}=2/\sigma^2.

  3. Find the length of the horizontal path σ=1\sigma=1 from μ=−1\mu=-1 to μ=1\mu=1, and the geodesic distance.

    Along σ=1\sigma=1, ds=dμds=d\mu, so the length is 2. The formula gives d=2arccosh⁡(1+22)=2arccosh⁡2≈1.862d=\sqrt2\operatorname{arccosh}(1+\tfrac{2}{2})=\sqrt2\operatorname{arccosh}2\approx1.862. The horizontal path is not a geodesic.

  4. Which distributions does the geodesic pass through?

    In (u,σ)(u,\sigma) the endpoints are (∓1/2,1)(\mp1/\sqrt2,1), so the circle is centred at u=0u=0 with radius 1/2+1≈1.225\sqrt{1/2+1}\approx1.225. The geodesic rises to N(0,1.2252)N(0,1.225^2) halfway: it is cheaper to widen the distribution, shift it, and narrow it again than to slide a narrow one sideways. Put A and B at these points above.

Check your understanding

In the Fisher metric, which is farther from N(0,1)N(0,1): N(0,0.52)N(0,0.5^2) or N(0,22)N(0,2^2)?

  1. N(0,22)N(0,2^2), because σ\sigma changes by 1 rather than 0.5The metric is 2dσ/σ\sqrt2\,d\sigma/\sigma along vertical lines: what counts is the ratio of the σ\sigma's, not their difference.
  2. N(0,0.52)N(0,0.5^2), because narrow distributions are far apartNarrowness matters, but here both changes are by the same factor of 2.
  3. They are equally far
Along μ=0\mu=0 the distance is ∫2dσ/σ=2|log⁡(σ2/σ1)|\int\sqrt2\,d\sigma/\sigma=\sqrt2\,|\log(\sigma_2/\sigma_1)|, which is 2log⁡2≈0.980\sqrt2\log2\approx0.980 for both. Doubling xx is an invertible change of units, so it preserves the Fisher geometry, and it maps N(0,0.52)↦N(0,1)N(0,0.5^2)\mapsto N(0,1) and N(0,1)↦N(0,22)N(0,1)\mapsto N(0,2^2).

The geodesic between N(−a,σ2)N(-a,\sigma^2) and N(a,σ2)N(a,\sigma^2) passes through…

  1. wider distributions than the endpoints
  2. only distributions with the same σ\sigmaDrag A and B to equal heights: the straight segment is longer than the geodesic.
  3. narrower distributions than the endpointsDistances grow like 1/σ1/\sigma as σ\sigma shrinks, so dipping down is expensive.
Horizontal movement costs dμ/σd\mu/\sigma, so it is cheaper at larger σ\sigma. The geodesic climbs to where moving sideways is cheap, like a great-circle flight route bending toward the pole.

We switch coordinates from (μ,σ)(\mu,\sigma) to (μ,v)(\mu,v) with v=σ2v=\sigma^2. What happens to the Fisher distance between two given normal distributions?

  1. Nothing; only the formula for gijg_{ij} changes
  2. It changes, since gvv≠gσσg_{vv}\ne g_{\sigma\sigma}The components change, but so do the coordinate differentials, and ds2ds^2 is the same quadratic form.
  3. It is multiplied by 2Lengths of curves are defined without reference to coordinates.
dσ=dv/(2v)d\sigma=dv/(2\sqrt v), so 2dσ2/σ2=dv2/(2v2)2\,d\sigma^2/\sigma^2=dv^2/(2v^2): gvv=1/(2v2)g_{vv}=1/(2v^2), a different number, but the same ds2ds^2. The Fisher metric is a tensor on the space of distributions, not a property of a parametrization.

Practice

The curvature is −1/2Scaling a metric

Assuming the Poincaré metric (du2+dσ2)/σ2(du^2+d\sigma^2)/\sigma^2 has Gaussian curvature −1-1, show that the Fisher metric of the normal family has curvature −12-\tfrac12.

Solution

Multiplying a metric by a constant cc multiplies all lengths by c\sqrt c and areas by cc. Gaussian curvature is angle excess per unit area (Gauss–Bonnet), and angles do not change, so KK is divided by cc. With c=2c=2, K=−12K=-\tfrac12.

A one-dimensional familyDistance in the exponential family of rates

For the exponential distributions p(x;λ)=λe−λxp(x;\lambda)=\lambda e^{-\lambda x}, x>0x>0, compute the Fisher information g(λ)g(\lambda) and the Fisher distance between rates λ1\lambda_1 and λ2\lambda_2.

Solution

∂λlog⁡p=1/λ−x\partial_\lambda\log p=1/\lambda-x, with variance Var(x)=1/λ2\mathrm{Var}(x)=1/\lambda^2. So g=1/λ2g=1/\lambda^2 and d=∫λ1λ2dλ/λ=|log⁡(λ2/λ1)|d=\int_{\lambda_1}^{\lambda_2}d\lambda/\lambda=|\log(\lambda_2/\lambda_1)|. Again only ratios matter, because changing the unit of xx is invertible and multiplies every rate by the same factor.

InteractiveAmari, Ch. 6: Dual Affine Connections and Dually Flat Manifold

Dual connections

A statistical manifold carries more than a metric: it carries two notions of "straight", the e- and m-connections, and they are dual with respect to the Fisher metric. On the Gaussian half-plane you can see all three geodesics at once and test the Pythagorean theorem with a protractor.

The idea

Dual connections. ∇\nabla and ∇*\nabla^* are dual with respect to gg if X⟨Y,Z⟩=⟨∇XY,Z⟩+⟨Y,∇X*Z⟩X\langle Y,Z\rangle=\langle\nabla_XY,Z\rangle+\langle Y,\nabla^*_XZ\rangle. Equivalently, transporting one vector by ∇\nabla and another by ∇*\nabla^* keeps their inner product constant. A connection is self-dual exactly when it preserves gg, like the Levi-Civita connection.
The α-connections. With the cubic (Amari–Chentsov) tensor Tijk=𝔼[∂iℓ∂jℓ∂kℓ]T_{ijk}=\mathbb E[\partial_i\ell\,\partial_j\ell\,\partial_k\ell], ℓ=log⁡p\ell=\log p, define Γijk(α)=Γijk(0)−α2Tijk\Gamma^{(\alpha)}_{ijk}=\Gamma^{(0)}_{ijk}-\tfrac\alpha2T_{ijk}, where Γ(0)\Gamma^{(0)} is Levi-Civita. Then ∇(α)\nabla^{(\alpha)} and ∇(−α)\nabla^{(-\alpha)} are dual; α=1\alpha=1 is the e-connection, α=−1\alpha=-1 the m-connection, and their average is Levi-Civita. Any divergence produces such a pair: its second derivatives give gg, its third derivatives give the two connections.
Dually flat manifolds. If ∇\nabla is flat with affine coordinates θ\theta, then ∇*\nabla^* is flat too, with affine coordinates η=∇ψ(θ)\eta=\nabla\psi(\theta) for a convex potential ψ\psi. The canonical divergence is the Bregman divergence of Module 1, and the Pythagorean theorem holds. Exponential families are dually flat: θ\theta natural parameters, η\eta expectation parameters.

For N(μ,σ2)N(\mu,\sigma^2): θ=(μ/σ2,−1/(2σ2))\theta=\big(\mu/\sigma^2,\,-1/(2\sigma^2)\big), η=(μ, μ2+σ2)\eta=(\mu,\ \mu^2+\sigma^2). The e-geodesic is a straight line in θ\theta, the m-geodesic a straight line in η\eta, and the Levi-Civita geodesic is the hyperbolic one from Module 5. Mixing the two systems also works: coordinates such as (η1,θ2)(\eta_1,\theta_2) cut a dually flat manifold into two families of flat slices that meet orthogonally.

Explore

e-geodesic m-geodesic Levi-Civita geodesic. Axes μ\mu (across) and σ\sigma (up).
Show

Worked example

Write the normal family in natural parameters, find its potential ψ\psi, check that ∇ψ\nabla\psi gives η\eta, and find the dual potential ψ*\psi^*.

  1. Put log⁡p\log p in the form θ⋅t(x)−ψ(θ)\theta\cdot t(x)-\psi(\theta).

    log⁡p=μσ2x−12σ2x2−μ22σ2−12log⁡(2πσ2)\log p=\frac{\mu}{\sigma^2}x-\frac{1}{2\sigma^2}x^2-\frac{\mu^2}{2\sigma^2}-\tfrac12\log(2\pi\sigma^2). So t=(x,x2)t=(x,x^2), θ1=μ/σ2\theta_1=\mu/\sigma^2, θ2=−1/(2σ2)\theta_2=-1/(2\sigma^2), and in terms of θ\theta

    ψ(θ)=−θ124θ2+12log⁡(−πθ2).\psi(\theta)=-\frac{\theta_1^2}{4\theta_2}+\tfrac12\log\Big(-\frac{\pi}{\theta_2}\Big).
  2. Differentiate ψ\psi.

    ∂1ψ=−θ1/(2θ2)=μ\partial_1\psi=-\theta_1/(2\theta_2)=\mu and ∂2ψ=θ12/(4θ22)−1/(2θ2)=μ2+σ2\partial_2\psi=\theta_1^2/(4\theta_2^2)-1/(2\theta_2)=\mu^2+\sigma^2. These are 𝔼[x]\mathbb E[x] and 𝔼[x2]\mathbb E[x^2], as they must be.

  3. Compute ψ*(η)=θ⋅η−ψ(θ)\psi^*(\eta)=\theta\cdot\eta-\psi(\theta).

    θ⋅η=μ2σ2−μ2+σ22σ2=μ22σ2−12\theta\cdot\eta=\frac{\mu^2}{\sigma^2}-\frac{\mu^2+\sigma^2}{2\sigma^2}=\frac{\mu^2}{2\sigma^2}-\frac12, and ψ=μ22σ2+12log⁡(2πσ2)\psi=\frac{\mu^2}{2\sigma^2}+\frac12\log(2\pi\sigma^2). So ψ*=−12log⁡(2πeσ2)\psi^*=-\tfrac12\log(2\pi e\sigma^2), minus the entropy of N(μ,σ2)N(\mu,\sigma^2), with σ2=η2−η12\sigma^2=\eta_2-\eta_1^2.

  4. Why are the e- and m-geodesics between N(−1,1)N(-1,1) and N(1,1)N(1,1) so different?

    Both endpoints have θ2=−12\theta_2=-\tfrac12, so the e-geodesic keeps θ2\theta_2 and hence σ=1\sigma=1 fixed: it is the horizontal segment. Both have η2=2\eta_2=2, so the m-geodesic keeps μ2+σ2=2\mu^2+\sigma^2=2: it is an arc of the circle of radius 2\sqrt2, reaching σ=2\sigma=\sqrt2 at μ=0\mu=0. The Levi-Civita geodesic lies between, peaking at σ≈1.225\sigma\approx1.225.

Check your understanding

What is the average 12(∇(1)+∇(−1))\tfrac12(\nabla^{(1)}+\nabla^{(-1)}) of the e- and m-connections?

  1. The Levi-Civita connection of the Fisher metric
  2. The flat connection of the θ\theta coordinatesThat is the e-connection itself, one of the two being averaged.
  3. It is not a connectionAn average of two connections (weights summing to 1) is again a connection.
From Γ(±1)=Γ(0)∓12T\Gamma^{(\pm1)}=\Gamma^{(0)}\mp\tfrac12T, the cubic terms cancel in the average. In the explorer the blue curve always runs between the gold and the green ones.

A=N(−1,1)A=N(-1,1), B=N(1,1)B=N(1,1). Which geodesic from AA to BB keeps σ\sigma constant?

  1. The e-geodesic
  2. The m-geodesicThe m-geodesic averages η2=μ2+σ2\eta_2=\mu^2+\sigma^2. In the middle μ2\mu^2 is smaller, so σ2\sigma^2 must be larger.
  3. The Levi-Civita geodesicThat one bends upward (Module 5).
θ2=−1/(2σ2)\theta_2=-1/(2\sigma^2) is the same at both ends, and the e-geodesic is linear in θ\theta. Place A and B at the same height to see it.

The m-geodesic from AA to BB and the e-geodesic from BB to CC are orthogonal at BB. Which identity follows?

  1. KL[A:C]=KL[A:B]+KL[B:C]\mathrm{KL}[A:C]=\mathrm{KL}[A:B]+\mathrm{KL}[B:C]
  2. KL[C:A]=KL[C:B]+KL[B:A]\mathrm{KL}[C:A]=\mathrm{KL}[C:B]+\mathrm{KL}[B:A]That version needs the roles swapped: an m-geodesic from CC to BB orthogonal to an e-geodesic from BB to AA.
  3. The Fisher distances satisfy dAC2=dAB2+dBC2d_{AC}^2=d_{AB}^2+d_{BC}^2The half-plane is curved (K=−12K=-\tfrac12), so the Riemannian Pythagoras is only approximate, for small triangles.
The m-side carries the first argument of KL, the e-side the second. In the explorer's triangle mode the defect is exactly −(θC−θB)⋅(ηA−ηB)-(\theta_C-\theta_B)\cdot(\eta_A-\eta_B), the pairing that measures the angle at BB.

Practice

Dual transport keeps inner productsBiorthogonal bases

In a dually flat manifold, let XX have constant components in the θ\theta basis ∂/∂θi\partial/\partial\theta^i (e-parallel) and YY constant components in the η\eta basis ∂/∂ηj\partial/\partial\eta_j (m-parallel). Show that ⟨X,Y⟩\langle X,Y\rangle is constant.

Hint

Compute ⟨∂/∂θi,∂/∂ηj⟩\langle\partial/\partial\theta^i,\partial/\partial\eta_j\rangle using ∂ηk/∂θi=gik\partial\eta_k/\partial\theta^i=g_{ik}.

Solution

∂/∂θi=∑kgik∂/∂ηk\partial/\partial\theta^i=\sum_k g_{ik}\,\partial/\partial\eta_k, and the η\eta-basis has inner products gkjg^{kj} (the inverse matrix). So ⟨∂θi,∂ηj⟩=∑kgikgkj=δij\langle\partial_{\theta^i},\partial_{\eta_j}\rangle=\sum_k g_{ik}g^{kj}=\delta_i^j. With X=ai∂θiX=a^i\partial_{\theta^i}, Y=bj∂ηjY=b_j\partial_{\eta_j}, ⟨X,Y⟩=∑iaibi\langle X,Y\rangle=\sum_ia^ib_i, which is constant when aa and bb are.

Mixed coordinates for two binary variablesMarginals and interaction

For p(x,y)p(x,y) on {0,1}2\{0,1\}^2, use η1=P(x=1)\eta_1=P(x=1), η2=P(y=1)\eta_2=P(y=1) and θ12=log⁡p11p00p10p01\theta_{12}=\log\frac{p_{11}p_{00}}{p_{10}p_{01}}. Show that independence is θ12=0\theta_{12}=0, and explain why projecting pp onto the independent distributions (minimizing KL[p:q]\mathrm{KL}[p:q]) keeps η1,η2\eta_1,\eta_2 fixed.

Solution

pp is a product exactly when its odds ratio is 1. Write log⁡p\log p in the exponential form θ1x+θ2y+θ12xy−ψ\theta_1x+\theta_2y+\theta_{12}xy-\psi; then θ12\theta_{12} is the log odds ratio, and {θ12=0}\{\theta_{12}=0\} is e-flat. The sets of fixed marginals {η1,η2 fixed}\{\eta_1,\eta_2\text{ fixed}\} are m-flat (linear constraints), and in mixed coordinates the two families meet orthogonally. The m-projection runs along an m-geodesic orthogonal to the e-flat target, so it stays in the slice with pp's marginals and lands at pXpYp_X\,p_Y, matching the mutual-information problem of Module 2.

SimulationAmari, Ch. 7: Asymptotic Theory of Statistical Inference

Efficient estimation

Data from an exponential family land on a point of its expectation space. A model is a curve in that space, and an estimator is a rule for sliding the observed point back onto the curve. Whether the estimator wastes information is decided by one angle: the one at which it slides.

The idea

Curved exponential family. A model M={p(x,u)}M=\{p(x,u)\} sitting inside an exponential family SS as a curve (or submanifold) η(u)\eta(u). After NN observations the average of the sufficient statistics, η^=1N∑kt(xk)\hat\eta=\frac1N\sum_k t(x_k), is a point of SS, usually not on MM. It contains everything the data say about uu.
Estimators and ancillary families. An estimator is a map u^=f(η^)\hat u=f(\hat\eta). Its level sets A(u)={η:f(η)=u}A(u)=\{\eta: f(\eta)=u\} form the ancillary family. The estimator is consistent when each A(u)A(u) passes through η(u)\eta(u).
First-order efficiency. Asymptotically NVar(u^)≥1/g(u)N\,\mathrm{Var}(\hat u)\ge 1/g(u), with gg the Fisher information (Cramér–Rao), and a consistent estimator attains 1/g(u)1/g(u) exactly when A(u)A(u) is orthogonal to MM at η(u)\eta(u) in the Fisher metric.
The MLE is an m-projection. 1N∑klog⁡p(xk,u)=θ(u)⋅η^−ψ(θ(u))\frac1N\sum_k\log p(x_k,u)=\theta(u)\cdot\hat\eta-\psi(\theta(u)), so maximizing likelihood is minimizing KL[pη^:pu]\mathrm{KL}[p_{\hat\eta}:p_u] over MM. The minimizer is where an m-geodesic from η^\hat\eta meets MM orthogonally, so the MLE's ancillary family is m-flat and orthogonal: the MLE is efficient.

Higher-order terms (bias, and the 1/N21/N^2 part of the variance) depend on how curved MM and A(u)A(u) are, measured by the e- and m-embedding curvatures; the MLE corrected for bias is second-order efficient. Below the model is N(u,u2)N(u,u^2), whose standard deviation equals its mean, inside the normal family with η=(𝔼x,𝔼x2)\eta=(\mathbb E x,\mathbb E x^2). True value u=1u=1.

Explore

Axes η1=x‾\eta_1=\bar x (across) and η2=x2\eta_2=\overline{x^2} (up). model η(u)=(u,2u2)\eta(u)=(u,2u^2) the estimator's ancillary lines simulated η^\hat\eta's. The grey region η2<η12\eta_2<\eta_1^2 is impossible.
Estimator

Worked example

For N(u,u2)N(u,u^2), u>0u>0: find the MLE, the Fisher information, and the asymptotic efficiency of x‾\bar x.

  1. Write the average log-likelihood in terms of m1=x‾m_1=\bar x and m2=x2m_2=\overline{x^2}.

    1Nℓ(u)=−log⁡u−m2−2um1+u22u2+const=−log⁡u−m22u2+m1u+const.\tfrac1N\ell(u) = -\log u-\frac{m_2-2um_1+u^2}{2u^2}+\text{const} = -\log u-\frac{m_2}{2u^2}+\frac{m_1}{u}+\text{const}.

    Only (m1,m2)=η^(m_1,m_2)=\hat\eta enters: it is sufficient.

  2. Solve the likelihood equation.

    −1u+m2u3−m1u2=0-\frac1u+\frac{m_2}{u^3}-\frac{m_1}{u^2}=0 gives u2+m1u−m2=0u^2+m_1u-m_2=0, so u^=12(−m1+m12+4m2)\hat u=\tfrac12\big(-m_1+\sqrt{m_1^2+4m_2}\big). For fixed uu the solutions form the line η2=uη1+u2\eta_2=u\,\eta_1+u^2 through η(u)=(u,2u2)\eta(u)=(u,2u^2): the MLE's ancillary family is a family of straight lines, as the theory says (m-flat).

  3. Compute the Fisher information g(u)g(u).

    Use the normal-family metric (dμ2+2dσ2)/σ2(d\mu^2+2d\sigma^2)/\sigma^2 from Module 5 along μ=σ=u\mu=\sigma=u: g(u)=(1+2)/u2=3/u2g(u)=(1+2)/u^2=3/u^2. So the best possible asymptotic variance is u2/(3N)u^2/(3N).

  4. What is the efficiency of x‾\bar x?

    Var(x‾)=u2/N\mathrm{Var}(\bar x)=u^2/N, so its efficiency is u2/3Nu2/N=13\frac{u^2/3N}{u^2/N}=\tfrac13. It ignores the information about uu carried by the spread of the data. Its ancillary lines are vertical, at a Fisher angle of about 35∘35^\circ to the model instead of 90∘90^\circ, and sin2⁡35.26∘=13\sin^2 35.26^\circ=\tfrac13.

Check your understanding

An estimator's ancillary line A(u)A(u) is the set of observed points it maps to uu. What makes the estimator consistent?

  1. Each A(u)A(u) passes through the model point η(u)\eta(u)
  2. Each A(u)A(u) is orthogonal to the modelThat is efficiency. A consistent estimator can cross at any angle.
  3. The lines A(u)A(u) are straightStraightness (m-flatness) matters for higher-order properties, not for consistency.
As N→∞N\to\infty, η^→η(u0)\hat\eta\to\eta(u_0) by the law of large numbers, so u^→f(η(u0))\hat u\to f(\eta(u_0)), which is u0u_0 exactly when η(u0)∈A(u0)\eta(u_0)\in A(u_0). All three estimators in the explorer are consistent; only one is efficient.

In a full exponential family (not curved), what is the MLE of the expectation parameter η\eta?

  1. η^\hat\eta itself, which attains the Cramér–Rao bound for every NN
  2. It has to be found numericallyMaximizing θ⋅η^−ψ(θ)\theta\cdot\hat\eta-\psi(\theta) gives ∇ψ(θ)=η^\nabla\psi(\theta)=\hat\eta directly.
  3. η^\hat\eta, but it is biased𝔼η^=𝔼t(x)=η\mathbb E\hat\eta=\mathbb E\,t(x)=\eta.
η^\hat\eta is unbiased with covariance Cov(t)/N\mathrm{Cov}(t)/N, and the Fisher information in η\eta-coordinates is Cov(t)−1\mathrm{Cov}(t)^{-1}. So it is exactly efficient. Curving the model is what makes estimation subtle.

x2/2\sqrt{\overline{x^2}/2} has efficiency 8/98/9 here. How many observations does it need to match the MLE with N=800N=800?

  1. 900
  2. 711That inverts the ratio. A less efficient estimator needs more data.
  3. 800Both are consistent, but their variances differ by a constant factor at every large NN.
Asymptotic variances are u2/(3N)u^2/(3N) for the MLE and 3u2/(8N)3u^2/(8N) for this estimator. Equal variance needs N′=800×3/81/3=900N'=800\times\frac{3/8}{1/3}=900. Efficiency is a ratio of sample sizes.

Practice

Efficiency from the angleA Fisher inner product

At u=1u=1, (x,x2)(x,x^2) has covariance Σ=(1226)\Sigma=\begin{pmatrix}1&2\\2&6\end{pmatrix}, and the Fisher metric in η\eta-coordinates is Σ−1\Sigma^{-1}. Compute the angle between the model tangent (1,4)(1,4) and the vertical direction (0,1)(0,1), and check that sin2⁡\sin^2 of it is 13\tfrac13.

Solution

Σ−1=12(6−2−21)\Sigma^{-1}=\tfrac12\begin{pmatrix}6&-2\\-2&1\end{pmatrix}. Then ⟨t,t⟩=3\langle t,t\rangle=3, ⟨a,a⟩=12\langle a,a\rangle=\tfrac12, ⟨t,a⟩=12(−2+4)=1\langle t,a\rangle=\tfrac12(-2+4)=1. So cos2⁡=13⋅12=23\cos^2=\frac{1}{3\cdot\frac12}=\tfrac23 and sin2⁡=13\sin^2=\tfrac13. The same computation with (1,1)(1,1), the MLE direction, gives ⟨t,a⟩=12(6−2−8+4)=0\langle t,a\rangle=\tfrac12(6-2-8+4)=0.

The log-odds of a coinEfficiency in another parametrization

With NN tosses of a coin with P(heads)=pP(\text{heads})=p, the MLE is p^\hat p, the frequency of heads. Find the asymptotic variance of the log-odds θ^=log⁡p^1−p^\hat\theta=\log\frac{\hat p}{1-\hat p}, and compare it with the Cramér–Rao bound for θ\theta.

Solution

dθ/dp=1/(p(1−p))d\theta/dp=1/(p(1-p)), so by the delta method Var(θ^)≈p(1−p)/N(p(1−p))2=1Np(1−p)\mathrm{Var}(\hat\theta)\approx\frac{p(1-p)/N}{(p(1-p))^2}=\frac{1}{Np(1-p)}. The Fisher information for θ\theta is ψ′′(θ)=p(1−p)\psi''(\theta)=p(1-p), so this is the bound: the MLE stays efficient under reparametrization. (Only asymptotically: θ^\hat\theta is infinite with positive probability for every finite NN.)

Animated lessonAmari, Ch. 8: Estimation in the Presence of Hidden Variables

The EM algorithm

When some variables are hidden, maximum likelihood gets hard, but two easy projections remain. EM alternates them: an e-projection fills in the hidden part as best it can, an m-projection refits the model, and the likelihood of the observed data can never go down.

The idea

Two manifolds. Let xx be observed and hh hidden. The model manifold is M={p(x,h;ξ)}M=\{p(x,h;\xi)\}. The data manifold is D={q(x,h):q(x)=p^(x)}D=\{q(x,h): q(x)=\hat p(x)\}, all joint distributions whose xx-marginal is the empirical distribution. DD is m-flat: it is cut out by linear constraints.
ML is the distance between them. By the chain rule for KL,
KL[q:pξ]=KL[p^(x):p(x;ξ)]+∑xp^(x)KL[q(h|x):p(h|x;ξ)].\mathrm{KL}[q:p_\xi]=\mathrm{KL}[\hat p(x):p(x;\xi)]+\sum_x\hat p(x)\,\mathrm{KL}\big[q(h|x):p(h|x;\xi)\big].
Minimizing over q∈Dq\in D kills the second term, and the first is −1Nlog⁡L(ξ)-\tfrac1N\log L(\xi) plus a constant. So minq∈D, ξ⁡KL[q:pξ]\min_{q\in D,\ \xi}\mathrm{KL}[q:p_\xi] is maximum likelihood.
E-step (e-projection onto D). For the current ξ\xi, the minimizer over q∈Dq\in D is q(x,h)=p^(x)p(h|x;ξ)q(x,h)=\hat p(x)\,p(h|x;\xi): fill in the hidden variable by its posterior.
M-step (m-projection onto M). Minimize KL[q:pξ]\mathrm{KL}[q:p_\xi] over ξ\xi, that is, maximize 𝔼q[log⁡p(x,h;ξ)]\mathbb E_q[\log p(x,h;\xi)]. For an exponential family this matches expected sufficient statistics.
Monotonicity. Neither step increases KL[q:pξ]\mathrm{KL}[q:p_\xi], and right after each E-step it equals −1Nlog⁡L(ξ)+const-\tfrac1N\log L(\xi)+\text{const}. So the log-likelihood never decreases. Typically it converges to a stationary point, which need not be the global maximum.

The animation fits a mixture 12N(a,1)+12N(b,1)\tfrac12N(a,1)+\tfrac12N(b,1) with unknown means; the hidden variable is which component produced each point.

Watch

Data
The (a,b)(a,b) plane: contours of the log-likelihood and the EM path. Drag the start point ξ₀.
component aa component bb; dots below are the data, coloured by their posterior.
  1. The data, and a first guess ξ0=(a,b)\xi_0=(a,b) for the two means.
  2. E-step: give each point its posterior probability of coming from each component (e-projection onto DD).
  3. M-step: move each mean to the posterior-weighted average of the data (m-projection onto MM).
  4. Repeat. The path climbs the likelihood surface; every step goes uphill.
  5. It settles at a stationary point of the likelihood. Try other starts, including one on the diagonal a=ba=b.

Worked example

Data x=(−2, 0, 3)x=(-2,\ 0,\ 3), model 12N(a,1)+12N(b,1)\tfrac12N(a,1)+\tfrac12N(b,1), start at a=−1, b=1a=-1,\ b=1. Do one EM iteration by hand.

  1. Find the posterior rk=P(h=b|xk)r_k=P(h=b\mid x_k) as a function of xkx_k.

    r=e−(x−b)2/2e−(x−a)2/2+e−(x−b)2/2=11+e((x−b)2−(x−a)2)/2r=\dfrac{e^{-(x-b)^2/2}}{e^{-(x-a)^2/2}+e^{-(x-b)^2/2}}=\dfrac{1}{1+e^{((x-b)^2-(x-a)^2)/2}}. With a=−1,b=1a=-1,b=1, (x−b)2−(x−a)2=−4x(x-b)^2-(x-a)^2=-4x, so r=1/(1+e−2x)r=1/(1+e^{-2x}).

  2. Evaluate the posteriors.

    r=(0.018, 0.5, 0.998)r=(0.018,\ 0.5,\ 0.998) for x=−2,0,3x=-2,0,3. The middle point is split evenly; the others are almost certain.

  3. M-step: compute the new means.

    b′=∑rkxk∑rk=−0.036+0+2.9931.516≈1.951,a′=∑(1−rk)xk∑(1−rk)=−1.964+0.0071.484≈−1.318.b'=\frac{\sum r_kx_k}{\sum r_k}=\frac{-0.036+0+2.993}{1.516}\approx1.951,\qquad a'=\frac{\sum(1-r_k)x_k}{\sum(1-r_k)}=\frac{-1.964+0.007}{1.484}\approx-1.318.
  4. Check that the log-likelihood went up.

    ∑klog⁡(12ϕ(xk−a)+12ϕ(xk−b))\sum_k\log\big(\tfrac12\phi(x_k-a)+\tfrac12\phi(x_k-b)\big) is about −7.12-7.12 at (−1,1)(-1,1) and −6.18-6.18 at (−1.318,1.951)(-1.318,1.951). The guarantee comes from the geometry: the E-step made the divergence equal to minus the log-likelihood, and the M-step could only lower it.

Check your understanding

The data manifold D={q(x,h):q(x)=p^(x)}D=\{q(x,h): q(x)=\hat p(x)\} is…

  1. m-flat
  2. e-flatFixing a marginal is a linear condition on qq, not on log⁡q\log q. The normalized geometric mean of two members can have a different marginal.
  3. neitherMix two members: (1−t)q+tq′(1-t)q+tq' still has marginal p^\hat p.
The marginal is linear in qq, so mixtures of members are members. That is why the E-step is an e-projection onto DD: the projection theorem of Module 2 needs the target to be m-flat when the projection is along an e-geodesic.

You start EM exactly on the diagonal, a=ba=b. What happens?

  1. It stays on the diagonal and converges to a=b=x‾a=b=\bar x, a saddle point
  2. It leaves the diagonal at once, because the likelihood is higher elsewhereEM is deterministic, and with a=ba=b every posterior is exactly 12\tfrac12. Nothing breaks the symmetry.
  3. It fails, because the M-step divides by zeroEach component gets total weight N/2N/2, so the weighted averages are defined.
With a=ba=b, both components get posterior 12\tfrac12 on every point, so both new means are x‾\bar x. The point (x‾,x‾)(\bar x,\bar x) is a stationary point of the likelihood. Along a=x‾+t, b=x‾−ta=\bar x+t,\ b=\bar x-t the log-likelihood has second derivative ∑k((xk−x‾)2−1)\sum_k\big((x_k-\bar x)^2-1\big), so it is a saddle, not a maximum, exactly when the sample variance exceeds 1, as it does for both data sets here. Drag the start onto the diagonal (it snaps) and play.

Which quantity is guaranteed never to decrease from one EM iteration to the next?

  1. The log-likelihood of the observed data
  2. The log-likelihood computed with the true hidden labelsEM never sees the true labels; nothing controls that quantity.
  3. The closeness of ξ\xi to the true parameterEM can climb to a local maximum or saddle far from the truth.
After an E-step, KL[q:pξ]=−1Nlog⁡L(ξ)+c\mathrm{KL}[q:p_\xi]=-\tfrac1N\log L(\xi)+c. The M-step lowers KL to some value ≥−1Nlog⁡L(ξ′)+c\ge-\tfrac1N\log L(\xi')+c (by the chain rule), so log⁡L(ξ′)≥log⁡L(ξ)\log L(\xi')\ge\log L(\xi). The "Δ log-lik" reading in the animation is never negative.

Practice

The E-step is a projectionThe chain rule for KL

Show that KL[q:p]=KL[qX:pX]+∑xq(x)KL[q(⋅|x):p(⋅|x)]\mathrm{KL}[q:p]=\mathrm{KL}[q_X:p_X]+\sum_xq(x)\,\mathrm{KL}[q(\cdot|x):p(\cdot|x)] and conclude that over q∈Dq\in D the minimum of KL[q:p]\mathrm{KL}[q:p] is at q(h|x)=p(h|x)q(h|x)=p(h|x).

Solution

Write q(x,h)=q(x)q(h|x)q(x,h)=q(x)q(h|x) and the same for pp; the logarithm of the ratio splits into a marginal part and a conditional part, and summing gives the identity. On DD, qX=p^q_X=\hat p is fixed, so only the second term varies, and it is zero exactly when every conditional matches.

Unknown mixing weightExtending the M-step

Let the model be (1−w)N(a,1)+wN(b,1)(1-w)N(a,1)+wN(b,1) with ww unknown too. Given posteriors rkr_k, find the M-step update for ww.

Solution

The expected complete-data log-likelihood contains ∑k(rklog⁡w+(1−rk)log⁡(1−w))\sum_k\big(r_k\log w+(1-r_k)\log(1-w)\big). Setting its derivative to zero gives w′=1N∑krkw'=\frac1N\sum_kr_k, the average posterior. The means update as before.

SimulationAmari, Ch. 9: Neyman-Scott Problem: Estimating Function and Semiparametric Statistical Model

Nuisance parameters

If every new observation brings its own new unknown, maximum likelihood can converge confidently to the wrong answer. An estimating function that is blind to the nuisance directions repairs it.

The idea

The Neyman–Scott problem. We observe pairs (xi,yi)(x_i,y_i), i=1,…,ni=1,\dots,n, independent, with xi,yi∼N(μi,σ2)x_i,y_i\sim N(\mu_i,\sigma^2). The parameter of interest is σ2\sigma^2; the means μ1,μ2,…\mu_1,\mu_2,\dots are nuisance parameters, one new one for each pair.
The MLE is inconsistent. Maximizing over all μi\mu_i gives μ^i=(xi+yi)/2\hat\mu_i=(x_i+y_i)/2 and
σ^ML2=14n∑i(xi−yi)2 ⟶ σ22.\hat\sigma^2_{\mathrm{ML}}=\frac{1}{4n}\sum_i(x_i-y_i)^2\ \longrightarrow\ \frac{\sigma^2}{2}.
More data never fixes it: each μ^i\hat\mu_i is always based on two observations.
Estimating function. A function y(x,σ2)y(x,\sigma^2) with 𝔼σ2,μ[y]=0\mathbb E_{\sigma^2,\mu}[y]=0 for every value of the nuisance. The estimate solves ∑iy(xi,σ^2)=0\sum_iy(x_i,\hat\sigma^2)=0, and it is consistent under mild conditions. Here y=12(x−y)2−σ2y=\tfrac12(x-y)^2-\sigma^2 works, giving σ~2=12n∑i(xi−yi)2\tilde\sigma^2=\frac1{2n}\sum_i(x_i-y_i)^2.
Geometry. Over each value of σ2\sigma^2 the model has a whole fibre of nuisance directions. A good estimating function is orthogonal (in the Fisher metric) to all of them. The best one is the efficient score: the score for σ2\sigma^2 minus its projection onto the nuisance directions. Here xi+yix_i+y_i carries all the information about μi\mu_i, and removing from the score its conditional expectation given xi+yix_i+y_i leaves a multiple of 12(xi−yi)2−σ2\tfrac12(x_i-y_i)^2-\sigma^2.

Explore

Nuisance means μᵢ
Estimates of σ2\sigma^2 (true value 1) as pairs arrive, log scale in nn. MLE estimating function wrong model: one common mean
Each pair as a point (xi,yi)(x_i,y_i). The nuisance moves points along the diagonal; σ\sigma is the spread across it.

Worked example

Derive the MLE of σ2\sigma^2 in the Neyman–Scott model and find its limit.

  1. Maximize the log-likelihood over μi\mu_i with σ2\sigma^2 fixed.

    ℓ=−nlog⁡(2πσ2)−12σ2∑i((xi−μi)2+(yi−μi)2)\ell=-n\log(2\pi\sigma^2)-\frac{1}{2\sigma^2}\sum_i\big((x_i-\mu_i)^2+(y_i-\mu_i)^2\big). Each μi\mu_i appears in one term, minimized at μ^i=(xi+yi)/2\hat\mu_i=(x_i+y_i)/2, where (xi−μ^i)2+(yi−μ^i)2=12(xi−yi)2(x_i-\hat\mu_i)^2+(y_i-\hat\mu_i)^2=\tfrac12(x_i-y_i)^2.

  2. Now maximize over σ2\sigma^2.

    The profile log-likelihood is −nlog⁡σ2−14σ2∑(xi−yi)2+const-n\log\sigma^2-\frac{1}{4\sigma^2}\sum(x_i-y_i)^2+\text{const}. Setting the derivative to zero, σ^2=14n∑(xi−yi)2\hat\sigma^2=\frac{1}{4n}\sum(x_i-y_i)^2.

  3. Find the limit as n→∞n\to\infty.

    xi−yi∼N(0,2σ2)x_i-y_i\sim N(0,2\sigma^2) whatever μi\mu_i is, so 𝔼(xi−yi)2=2σ2\mathbb E(x_i-y_i)^2=2\sigma^2, and by the law of large numbers σ^2→2σ2/4=σ2/2\hat\sigma^2\to2\sigma^2/4=\sigma^2/2.

  4. Why did the usual consistency theorem fail?

    It assumes a fixed, finite number of parameters. Here the number of parameters, n+1n+1, grows with the data, so the μ^i\hat\mu_i never settle down, and their errors bias σ^2\hat\sigma^2 by the same factor at every nn. The estimating function 12(x−y)2−σ2\tfrac12(x-y)^2-\sigma^2 avoids μi\mu_i entirely.

Check your understanding

In the explorer, switch the nuisance means to "all equal to 0". The MLE still estimates a separate μi\mu_i for each pair. Where does it converge now?

  1. Still to σ2/2\sigma^2/2
  2. To σ2\sigma^2, since there is no variation in the means to confuse itThe estimator only sees xi−yix_i-y_i, whose distribution does not depend on the μi\mu_i at all.
  3. To 0𝔼(xi−yi)2=2σ2>0\mathbb E(x_i-y_i)^2=2\sigma^2>0.
The bias comes from fitting nn free means, not from their values. What changes with the spread is the "common mean" estimator, which is wrong when the means vary and fine when they are all equal.

Suppose each μi\mu_i is observed three times instead of twice. Where does the MLE of σ2\sigma^2 converge?

  1. 23σ2\tfrac23\sigma^2
  2. 13σ2\tfrac13\sigma^2The MLE divides the within-group sum of squares by 3n3n; that sum has expectation (3−1)nσ2(3-1)n\sigma^2.
  3. σ2\sigma^2More observations per nuisance parameter reduce the bias but do not remove it.
With kk observations per group, σ^2=1kn∑i∑j(xij−x‾i)2→k−1kσ2\hat\sigma^2=\frac{1}{kn}\sum_i\sum_j(x_{ij}-\bar x_i)^2\to\frac{k-1}{k}\sigma^2. One degree of freedom per group is spent on estimating μi\mu_i.

What makes y=12(x−y)2−σ2y=\tfrac12(x-y)^2-\sigma^2 a valid estimating function?

  1. Its expectation is zero for every value of the nuisance μi\mu_i
  2. It is the score function for σ2\sigma^2The score is −1σ2+(x−μ)2+(y−μ)22σ4-\tfrac1{\sigma^2}+\frac{(x-\mu)^2+(y-\mu)^2}{2\sigma^4}, which involves the unknown μ\mu.
  3. Its expectation is zero when μi=0\mu_i=0That would not be enough: we need unbiasedness whatever the μi\mu_i are, since we never learn them.
x−y∼N(0,2σ2)x-y\sim N(0,2\sigma^2) for every μ\mu, so 𝔼[12(x−y)2]=σ2\mathbb E[\tfrac12(x-y)^2]=\sigma^2 regardless. Averaging over pairs then gives a consistent estimate, by the law of large numbers.

Practice

Four pairsThe two estimates side by side

The differences xi−yix_i-y_i for four pairs are 0.4, −1.0, 1.6, 0.20.4,\ -1.0,\ 1.6,\ 0.2. Compute σ^ML2\hat\sigma^2_{\mathrm{ML}} and σ~2\tilde\sigma^2.

Solution

∑di2=0.16+1+2.56+0.04=3.76\sum d_i^2=0.16+1+2.56+0.04=3.76. So σ^ML2=3.76/16=0.235\hat\sigma^2_{\mathrm{ML}}=3.76/16=0.235 and σ~2=3.76/8=0.47\tilde\sigma^2=3.76/8=0.47, always in the ratio 1 : 2.

Conditioning away the nuisanceA likelihood that works

Show that di=xi−yid_i=x_i-y_i and si=xi+yis_i=x_i+y_i are independent, that the distribution of did_i does not involve μi\mu_i, and that maximizing the likelihood of the did_i alone gives σ~2\tilde\sigma^2.

Solution

(di,si)(d_i,s_i) is a linear image of a Gaussian vector with Cov(di,si)=σ2−σ2=0\mathrm{Cov}(d_i,s_i)=\sigma^2-\sigma^2=0, so they are jointly Gaussian and uncorrelated, hence independent. di∼N(0,2σ2)d_i\sim N(0,2\sigma^2). The MLE of the variance 2σ22\sigma^2 from the did_i is 1n∑di2\frac1n\sum d_i^2, so σ2\sigma^2 is estimated by 12n∑di2=σ~2\frac1{2n}\sum d_i^2=\tilde\sigma^2.

Step-throughAmari, Ch. 11: Machine Learning

Clustering with divergences

k-means works for any Bregman divergence, not only squared distance. Surprisingly, the centre of a cluster is still its plain average and the boundaries between clusters are still straight lines. What the divergence changes is where those lines go.

The idea

Bregman centroid. For points x1,…,xmx_1,\dots,x_m and any Bregman divergence,
∑kDψ[xk:c]=∑kDψ[xk:x‾]+mDψ[x‾:c],\sum_kD_\psi[x_k:c]=\sum_kD_\psi[x_k:\bar x]+m\,D_\psi[\bar x:c],
so arg⁡minc⁡∑kDψ[xk:c]=x‾\arg\min_c\sum_kD_\psi[x_k:c]=\bar x, the arithmetic mean, whatever ψ\psi is.
The other side. arg⁡minc⁡∑kDψ[c:xk]\arg\min_c\sum_kD_\psi[c:x_k] is the mean taken in the dual coordinates, ∇ψ*(1m∑k∇ψ(xk))\nabla\psi^*\big(\tfrac1m\sum_k\nabla\psi(x_k)\big). For the generalized KL divergence that is the geometric mean, for Itakura–Saito the harmonic mean.
Straight boundaries. Dψ[x:c1]−Dψ[x:c2]D_\psi[x:c_1]-D_\psi[x:c_2] is an affine function of xx: the ψ(x)\psi(x) terms cancel. So the cells {x:Dψ[x:cj] smallest}\{x: D_\psi[x:c_j]\text{ smallest}\} are convex polygons.
Bregman k-means. Alternate: assign each point to the centre with the smallest Dψ[x:cj]D_\psi[x:c_j]; move each centre to the mean of its points. Each step lowers ∑kDψ[xk:cj(k)]\sum_kD_\psi[x_k:c_{j(k)}] or leaves it alone, so the algorithm stops after finitely many changes.

The chapter applies the same geometry to support vector machines, belief propagation, boosting and Bayesian learning; this module takes clustering. Below are positive 2-D data with multiplicative noise, so a divergence that measures relative error behaves very differently from squared distance. Per coordinate: squared distance 12(x−c)2\tfrac12(x-c)^2; generalized KL xlog⁡xc−x+cx\log\frac xc-x+c; Itakura–Saito xc−log⁡xc−1\frac xc-\log\frac xc-1.

Explore

Shaded cells: where each centre is closest in the chosen divergence. Drag the centres (crosses), or step the algorithm.
Divergence

Worked example

Two numbers, 1 and 4. Find both centroids for squared distance, generalized KL and Itakura–Saito.

  1. Prove the centroid identity in the box above.

    Expand: ∑kD[xk:c]−∑kD[xk:x‾]=mψ(x‾)−mψ(c)−∇ψ(c)⋅∑k(xk−c)+∇ψ(x‾)⋅∑k(xk−x‾)\sum_kD[x_k:c]-\sum_kD[x_k:\bar x]=m\psi(\bar x)-m\psi(c)-\nabla\psi(c)\cdot\sum_k(x_k-c)+\nabla\psi(\bar x)\cdot\sum_k(x_k-\bar x). The last sum is 0 and ∑k(xk−c)=m(x‾−c)\sum_k(x_k-c)=m(\bar x-c), leaving m(ψ(x‾)−ψ(c)−∇ψ(c)⋅(x‾−c))=mD[x‾:c]m\big(\psi(\bar x)-\psi(c)-\nabla\psi(c)\cdot(\bar x-c)\big)=mD[\bar x:c].

  2. What are the "data first" centroids of 1 and 4?

    All three are 2.52.5, the arithmetic mean.

  3. What are the "centre first" centroids?

    Squared distance: ∇ψ(x)=x\nabla\psi(x)=x, so again 2.52.5. Generalized KL, ψ=xlog⁡x−x\psi=x\log x-x: ∇ψ=log⁡x\nabla\psi=\log x, so the centroid is exp⁡(log⁡1+log⁡42)=2\exp\big(\tfrac{\log1+\log4}{2}\big)=2. Itakura–Saito, ψ=−log⁡x\psi=-\log x: ∇ψ=−1/x\nabla\psi=-1/x, so the centroid is 1/(1+1/42)=1.61/\big(\tfrac{1+1/4}{2}\big)=1.6.

  4. Which side does the explorer use, and what difference does the divergence make there?

    Data first, so every centre update is a plain average. The divergence enters only through the assignment: Itakura–Saito depends only on the ratio x/cx/c, so it hands a big outlying point to a big centre that is far away in absolute terms, while squared distance hands it to the nearest one.

Check your understanding

Under the generalized KL divergence D[x:c]=∑j(xjlog⁡xjcj−xj+cj)D[x:c]=\sum_j\big(x_j\log\frac{x_j}{c_j}-x_j+c_j\big), which cc minimizes ∑kD[xk:c]\sum_kD[x_k:c]?

  1. The arithmetic mean of the xkx_k
  2. The geometric meanThat minimizes ∑kD[c:xk]\sum_kD[c:x_k], with the centre first.
  3. The coordinatewise medianThe median minimizes absolute deviations, which are not a Bregman divergence.
The centroid identity holds for every Bregman divergence when the data are in the first slot. Directly: ∂cj∑k(−xkjlog⁡cj+cj)=−∑kxkj/cj+m=0\partial_{c_j}\sum_k(-x_{kj}\log c_j+c_j)=-\sum_kx_{kj}/c_j+m=0, so cj=x‾jc_j=\bar x_j.

With Itakura–Saito and data in the first slot, the boundary between two clusters is…

  1. a straight line
  2. a curve that bends around the smaller centreWrite out D[x:c1]−D[x:c2]D[x:c_1]-D[x:c_2]: the log⁡xj\log x_j terms cancel and what is left is affine in xx.
  3. a circleEven for squared distance the boundary between two centres is a line, the perpendicular bisector.
D[x:c1]−D[x:c2]=∑jxj(1c1j−1c2j)+∑jlog⁡c1jc2jD[x:c_1]-D[x:c_2]=\sum_jx_j\big(\tfrac1{c_{1j}}-\tfrac1{c_{2j}}\big)+\sum_j\log\frac{c_{1j}}{c_{2j}}, affine in xx. The line is just not the perpendicular bisector. The shaded cells in the explorer are always polygons.

Why can each step of Bregman k-means only lower the objective ∑kD[xk:cj(k)]\sum_kD[x_k:c_{j(k)}]?

  1. Assignment picks the smallest divergence for each point, and the update picks the minimizing centre (the mean) for each cluster
  2. Because Bregman divergences are symmetricThey are not (Module 1), and no symmetry is used.
  3. Because the objective is convex in the centres and the assignments togetherIt is not jointly convex: k-means can stop at different local solutions from different starts. Try "New random start".
Each step minimizes the objective exactly over one block of variables with the other fixed: a coordinate-descent argument, the same alternating-minimization pattern as EM in Module 8.

Practice

The other-sided centroidUsing the dual divergence

Prove that arg⁡minc⁡∑kDψ[c:xk]=∇ψ*(1m∑k∇ψ(xk))\arg\min_c\sum_kD_\psi[c:x_k]=\nabla\psi^*\big(\tfrac1m\sum_k\nabla\psi(x_k)\big).

Hint

Module 1: Dψ[c:x]=Dψ*[∇ψ(x):∇ψ(c)]D_\psi[c:x]=D_{\psi^*}[\nabla\psi(x):\nabla\psi(c)].

Solution

In dual coordinates the problem is min⁡∑kDψ*[yk:γ]\min\sum_kD_{\psi^*}[y_k:\gamma] with yk=∇ψ(xk)y_k=\nabla\psi(x_k), γ=∇ψ(c)\gamma=\nabla\psi(c). By the centroid identity for ψ*\psi^* the minimizer is γ=y‾\gamma=\bar y, so c=∇ψ*(y‾)c=\nabla\psi^*(\bar y).

The KL boundaryAn explicit line

For the generalized KL divergence in two dimensions, find the boundary between centres c1=(1,1)c_1=(1,1) and c2=(2,1)c_2=(2,1).

Solution

D[x:c1]−D[x:c2]=∑jxjlog⁡c2jc1j+∑j(c1j−c2j)=x1log⁡2−1D[x:c_1]-D[x:c_2]=\sum_jx_j\log\frac{c_{2j}}{c_{1j}}+\sum_j(c_{1j}-c_{2j})=x_1\log2-1. The boundary is the vertical line x1=1/log⁡2≈1.443x_1=1/\log2\approx1.443, not the bisector x1=1.5x_1=1.5: it sits closer to the smaller centre, as relative error suggests.

SimulationAmari, Ch. 12: Natural Gradient Learning and Its Dynamics in Singular Regions

Natural gradient

Ordinary gradient descent depends on how you happen to parametrize a model. The natural gradient asks a different question: which small change of the distribution, measured by the Fisher metric, lowers the loss fastest? Its path does not depend on the parametrization.

The idea

Steepest descent in a metric. Minimizing L(ξ+dξ)L(\xi+d\xi) subject to 12dξ𝖳G(ξ)dξ=ε2\tfrac12\,d\xi^{\mathsf T}G(\xi)\,d\xi=\varepsilon^2 gives dξ∝−G−1∇Ld\xi\propto-G^{-1}\nabla L. The natural gradient is ∇~L=G−1∇L\tilde\nabla L=G^{-1}\nabla L, and learning is ξt+1=ξt−ηG−1(ξt)∇L(ξt)\xi_{t+1}=\xi_t-\eta\,G^{-1}(\xi_t)\nabla L(\xi_t).
Invariance. Under a change of coordinates both ∇L\nabla L and GG transform, and G−1∇LG^{-1}\nabla L transforms as a tangent vector. So the natural gradient flow traces the same curve of distributions in any coordinates; discrete steps agree to first order in η\eta.
Efficiency. In online learning from one example at a time, natural gradient with step ηt=1/t\eta_t=1/t is asymptotically Fisher-efficient: it achieves the Cramér–Rao bound of Module 7. Plain gradient descent generally does not.
Singular regions and plateaus. In a multilayer perceptron, different parameters can give the same function: when two hidden units coincide, or a unit's output weight is zero. On these sets the Fisher metric degenerates. Plain gradient learning gets trapped near them for long periods (plateaus), while the natural gradient, which rescales by G−1G^{-1}, escapes them much faster.

Below, a normal model N(μ,σ2)N(\mu,\sigma^2) is fitted to the target N(1,0.42)N(1,0.4^2) by minimizing L=KL[target:model]=log⁡σ0.4+0.42+(μ−1)22σ2−12L=\mathrm{KL}[\text{target}:\text{model}]=\log\frac{\sigma}{0.4}+\frac{0.4^2+(\mu-1)^2}{2\sigma^2}-\frac12. With G=diag(1/σ2,2/σ2)G=\mathrm{diag}(1/\sigma^2,2/\sigma^2) the natural gradient step is Δμ=−η(μ−1)\Delta\mu=-\eta(\mu-1), Δσ=−η2(σ−0.42+(μ−1)2σ)\Delta\sigma=-\tfrac\eta2\big(\sigma-\frac{0.4^2+(\mu-1)^2}{\sigma}\big).

Explore

Plain gradient descent in coordinates
natural gradient plain gradient. Contours of LL. Drag the start point; the target is the ring.
log10⁡L\log_{10}L against iteration (first 150).

Worked example

Fit a Bernoulli model in its natural parameter θ\theta (the log-odds) to data with frequency p^=0.8\hat p=0.8, by minimizing the average negative log-likelihood L(θ)=ψ(θ)−θp^L(\theta)=\psi(\theta)-\theta\hat p, ψ=log⁡(1+eθ)\psi=\log(1+e^\theta). Start at θ=0\theta=0 and use step size 1.

  1. Compute ∇L\nabla L and the Fisher information GG.

    L′(θ)=ψ′(θ)−p^=p−p^L'(\theta)=\psi'(\theta)-\hat p=p-\hat p with p=1/(1+e−θ)p=1/(1+e^{-\theta}), and G=ψ′′(θ)=p(1−p)G=\psi''(\theta)=p(1-p).

  2. Take one plain and one natural gradient step from θ=0\theta=0.

    At θ=0\theta=0: p=0.5p=0.5, L′=−0.3L'=-0.3, G=0.25G=0.25. Plain: θ=0.3\theta=0.3, so p=0.574p=0.574. Natural: θ=0+0.3/0.25=1.2\theta=0+0.3/0.25=1.2, so p=0.769p=0.769.

  3. Take a second natural gradient step. How close is it to the answer θ*=log⁡4≈1.386\theta^*=\log4\approx1.386?

    At θ=1.2\theta=1.2: p=0.7685p=0.7685, L′=−0.0315L'=-0.0315, G=0.1779G=0.1779, so θ=1.2+0.177=1.377\theta=1.2+0.177=1.377, with p=0.7985p=0.7985. The error went from 0.186 to 0.009: quadratic convergence.

  4. Explain the speed.

    For an exponential family in natural parameters, L′′(θ)=ψ′′(θ)=G(θ)L''(\theta)=\psi''(\theta)=G(\theta): the Fisher information is the Hessian of the loss. So the natural gradient step with η=1\eta=1 is exactly Newton's method here.

Check your understanding

From the same start, with a very small step, plain gradient descent on L(μ,σ)L(\mu,\sigma) and on L(μ,log⁡σ)L(\mu,\log\sigma) trace…

  1. different paths of distributions, while the natural gradient traces the same path in both
  2. the same path, since it is the same functionThe gradient's components change: ∂L/∂log⁡σ=σ∂L/∂σ\partial L/\partial\log\sigma=\sigma\,\partial L/\partial\sigma, and a step in log⁡σ\log\sigma moves σ\sigma by σ\sigma times as much again. The σ\sigma-velocity is multiplied by σ2\sigma^2.
  3. the same path, but at different speedsOnly the σ\sigma component is rescaled, so the direction changes too.
Plain gradient descent secretly uses the Euclidean metric of whatever coordinates it is given. The natural gradient uses the Fisher metric, which belongs to the distributions. Toggle the coordinates in the explorer: only the red path moves.

Why does plain gradient descent in (μ,σ)(\mu,\sigma) need tiny steps when σ\sigma is small?

  1. The loss curvature in μ\mu is about 1/σ21/\sigma^2, so a stable step must be of order σ2\sigma^2
  2. The loss is not differentiable at small σ\sigmaIt is smooth for every σ>0\sigma>0.
  3. The gradient vanishes thereThe opposite: it is huge, like 1/σ21/\sigma^2 and 1/σ31/\sigma^3.
Gradient descent on a quadratic with curvature kk is stable only for η<2/k\eta<2/k. The natural gradient multiplies by G−1G^{-1}, which contains the factor σ2\sigma^2, so its step adapts automatically.

What causes the long plateaus in gradient training of multilayer perceptrons?

  1. Singular regions, where hidden units coincide or vanish and the Fisher metric degenerates
  2. Local minimaA plateau is not a minimum: learning does eventually escape it, after a long slow phase.
  3. A step size that is too smallLarger steps do not remove the plateau; the slow direction comes from the geometry near the singular set.
Near a singular region, many parameters represent nearly the same function, so the gradient in the escaping direction is tiny. In the metric that measures change of function, that direction is not short at all, and the natural gradient moves along it at normal speed.

Practice

A Gaussian meanThe natural gradient forgets σ

For N(μ,σ2)N(\mu,\sigma^2) with σ\sigma known and loss L(μ)=12σ2⋅1N∑k(xk−μ)2L(\mu)=\frac{1}{2\sigma^2}\cdot\frac1N\sum_k(x_k-\mu)^2, compute the plain and natural gradient steps in μ\mu.

Solution

L′(μ)=(μ−x‾)/σ2L'(\mu)=(\mu-\bar x)/\sigma^2 and G=1/σ2G=1/\sigma^2. Plain: Δμ=−η(μ−x‾)/σ2\Delta\mu=-\eta(\mu-\bar x)/\sigma^2, whose behaviour depends on σ\sigma. Natural: Δμ=−η(μ−x‾)\Delta\mu=-\eta(\mu-\bar x), the same for every σ\sigma; with η=1\eta=1 it jumps to x‾\bar x at once.

Why it is invariantThe transformation rule

Let ξ=f(ζ)\xi=f(\zeta) with Jacobian J=∂ξ/∂ζJ=\partial\xi/\partial\zeta. Show that JGζ−1∇ζL=Gξ−1∇ξLJ\,G_\zeta^{-1}\nabla_\zeta L=G_\xi^{-1}\nabla_\xi L: the two natural gradients are the same tangent vector.

Solution

∇ζL=J𝖳∇ξL\nabla_\zeta L=J^{\mathsf T}\nabla_\xi L and Gζ=J𝖳GξJG_\zeta=J^{\mathsf T}G_\xi J. So Gζ−1∇ζL=J−1Gξ−1J−𝖳J𝖳∇ξL=J−1Gξ−1∇ξLG_\zeta^{-1}\nabla_\zeta L=J^{-1}G_\xi^{-1}J^{-\mathsf T}J^{\mathsf T}\nabla_\xi L=J^{-1}G_\xi^{-1}\nabla_\xi L; multiply by JJ. The plain gradient ∇ζL\nabla_\zeta L instead becomes JJ𝖳∇ξLJJ^{\mathsf T}\nabla_\xi L in ξ\xi-coordinates, which depends on ff.

SimulationAmari, Ch. 13: Signal Processing and Optimization

Independent component analysis

Two independent signals are mixed by an unknown matrix, and we see only the mixtures. ICA searches the group of invertible matrices for one that makes the outputs independent again. The natural gradient on that group makes the learning dynamics independent of how badly the signals were mixed.

The idea

The model. x=Asx=As, where ss has independent, non-Gaussian components and AA is invertible and unknown. We look for WW such that y=Wxy=Wx has independent components. At best this recovers ss up to the order and scale of its components.
The loss. Choose model densities qiq_i for the sources. The negative log-likelihood per sample is L(W)=−log⁡|det⁡W|−∑i𝔼log⁡qi(yi)L(W)=-\log|\det W|-\sum_i\mathbb E\log q_i(y_i), with gradient ∇L=−W−𝖳+𝔼[φ(y)x𝖳]\nabla L=-W^{-\mathsf T}+\mathbb E[\varphi(y)x^{\mathsf T}], where φi=−(log⁡qi)′\varphi_i=-(\log q_i)'.
Natural gradient on the matrix group. Use a metric on invertible matrices that is invariant under W↦WBW\mapsto WB (it measures dWdW through dWW−1dW\,W^{-1}). The natural gradient step is
ΔW=η(I−𝔼[φ(y)y𝖳])W,\Delta W=\eta\big(I-\mathbb E[\varphi(y)y^{\mathsf T}]\big)W,
which also needs no matrix inverse.
Equivariance. Write C=WAC=WA, so that y=Csy=Cs. The natural gradient gives ΔC=η(I−𝔼[φ(Cs)(Cs)𝖳])C\Delta C=\eta\big(I-\mathbb E[\varphi(Cs)(Cs)^{\mathsf T}]\big)C: AA has disappeared. The plain gradient gives ΔC=η(C−𝖳−𝔼[φ(y)s𝖳])A𝖳A\Delta C=\eta\big(C^{-\mathsf T}-\mathbb E[\varphi(y)s^{\mathsf T}]\big)A^{\mathsf T}A, which depends on AA through A𝖳AA^{\mathsf T}A.

The chapter also treats PCA, non-negative matrix factorization, sparse signal processing, convex programming and game-theoretic scores; this module takes ICA. Below: 400 samples of two uniform sources (sub-Gaussian, so φ(y)=y3\varphi(y)=y^3 is a suitable choice), batch updates with η=0.05\eta=0.05, and both runs start from the same global matrix C0=W0AC_0=W_0A.

Explore

Mixing matrix A
Scatter shows
The mixtures x=Asx=As. Independent uniform sources would fill an axis-aligned square.
Separation error of C=WAC=WA (0 means a scaled permutation), log scale. natural plain

Worked example

Derive the equivariance property, and find where the algorithm settles for uniform sources.

  1. Turn the plain gradient into the natural gradient.

    For this invariant metric the natural gradient is ∇LW𝖳W\nabla L\,W^{\mathsf T}W. So ΔW=−η(−W−𝖳+𝔼[φ(y)x𝖳])W𝖳W=η(I−𝔼[φ(y)y𝖳])W\Delta W=-\eta\big(-W^{-\mathsf T}+\mathbb E[\varphi(y)x^{\mathsf T}]\big)W^{\mathsf T}W=\eta\big(I-\mathbb E[\varphi(y)y^{\mathsf T}]\big)W, using x𝖳W𝖳=y𝖳x^{\mathsf T}W^{\mathsf T}=y^{\mathsf T}.

  2. Multiply on the right by AA. What do you get?

    ΔC=ΔWA=η(I−𝔼[φ(y)y𝖳])C\Delta C=\Delta W\,A=\eta\big(I-\mathbb E[\varphi(y)y^{\mathsf T}]\big)C, and y=Csy=Cs. Everything is in terms of CC and ss: the trajectory of CC depends only on where it starts.

  3. Where does it stop? Take y=Dsy=Ds with DD diagonal and sis_i uniform with unit variance.

    Off the diagonal, 𝔼[yi3yj]=𝔼[yi3]𝔼[yj]=0\mathbb E[y_i^3y_j]=\mathbb E[y_i^3]\,\mathbb E[y_j]=0 by independence. On the diagonal we need 𝔼[yi4]=1\mathbb E[y_i^4]=1: di4𝔼[si4]=1d_i^4\,\mathbb E[s_i^4]=1. For uniform ss on [−3,3][-\sqrt3,\sqrt3], 𝔼s4=9/5\mathbb E s^4=9/5, so di=(5/9)1/4≈0.863d_i=(5/9)^{1/4}\approx0.863. Look at the diagonal of CC in the explorer after a run (the sample of 400 moves it slightly).

  4. And the plain gradient?

    ΔC=η(C−𝖳−𝔼[φ(y)s𝖳])A𝖳A\Delta C=\eta\big(C^{-\mathsf T}-\mathbb E[\varphi(y)s^{\mathsf T}]\big)A^{\mathsf T}A. Same fixed points, but the step is preconditioned by A𝖳AA^{\mathsf T}A. A badly conditioned AA makes it slow in one direction and unstable in another, which is what the "severe" setting shows.

Check your understanding

Even with perfect data, ICA can recover the sources only up to…

  1. their order and their scales (including sign)
  2. a rotationA rotation of independent non-Gaussian sources makes them dependent again, and ICA can detect that.
  3. nothing: they are recovered exactlyAs=(AP−1Λ−1)(ΛPs)As=(AP^{-1}\Lambda^{-1})(\Lambda Ps) for any permutation PP and diagonal Λ\Lambda: the data cannot tell these apart.
Rescaling or reordering independent sources keeps them independent, and the mixing matrix absorbs the change. Everything else is identifiable when at most one source is Gaussian.

Why can ICA not separate two Gaussian sources?

  1. A rotation of independent standard Gaussians is again a pair of independent standard Gaussians
  2. Gaussian signals have no fourth momentThey have every moment; the fourth is 3σ43\sigma^4.
  3. The natural gradient is undefined for GaussiansThe algorithm runs; the problem is that the answer is not unique.
After whitening, every rotation gives independent outputs, so independence cannot single out the true one. Non-Gaussianity is what breaks the rotational symmetry. The uniform sources here fill a square, which is clearly not rotation-invariant.

Equivariance of the natural-gradient rule says that the trajectory of C=WAC=WA…

  1. depends only on its starting value and the sources, not on AA
  2. depends on AA only through its condition numberThat describes the plain gradient, whose dynamics carry the factor A𝖳AA^{\mathsf T}A.
  3. does not depend on the sourcesThe update averages φ(y)y𝖳\varphi(y)y^{\mathsf T} over y=Csy=Cs, so the sources matter.
In the explorer the blue error curve is identical for all three mixing matrices; the red one changes. Because both runs start at the same C0C_0, the only difference between the settings is AA itself.

Practice

The gradient of the log-determinantWhere W^(−T) comes from

Show that ∂log⁡|det⁡W|/∂Wij=(W−𝖳)ij\partial\log|\det W|/\partial W_{ij}=(W^{-\mathsf T})_{ij}, and hence derive ∇L\nabla L above.

Solution

dlog⁡|det⁡W|=tr(W−1dW)=∑ij(W−1)jidWijd\log|\det W|=\mathrm{tr}(W^{-1}dW)=\sum_{ij}(W^{-1})_{ji}\,dW_{ij}, so the gradient is (W−1)𝖳(W^{-1})^{\mathsf T}. For the other term, ∂(−log⁡qi(yi))/∂Wij=φi(yi)xj\partial(-\log q_i(y_i))/\partial W_{ij}=\varphi_i(y_i)\,x_j, which gives 𝔼[φ(y)x𝖳]\mathbb E[\varphi(y)x^{\mathsf T}].

Super-Gaussian sourcesChoosing the nonlinearity

For Laplace sources, density ∝e−2|s|\propto e^{-\sqrt2|s|} (unit variance), what is the score φ=−(log⁡q)′\varphi=-(\log q)' if qq is the true density? Why do practical algorithms use tanh⁡\tanh instead?

Solution

−log⁡q=2|s|+const-\log q=\sqrt2|s|+\text{const}, so φ(s)=2sign(s)\varphi(s)=\sqrt2\,\mathrm{sign}(s). It is discontinuous at 0, which makes the update rough; tanh⁡(βy)\tanh(\beta y) is a smooth approximation of a sign function and has the same qualitative effect for super-Gaussian sources. (For sub-Gaussian sources, as in the explorer, a cubic such as y3y^3 is the usual choice.)