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[ΞΎ:ΞΎβ€²] of two points with Dβ‰₯0, equality only when ΞΎ=ΞΎβ€², and, for nearby points,
D[ΞΎ:ΞΎ+dΞΎ]=12βˆ‘i,jgij(ΞΎ)dΞΎidΞΎj+O(|dΞΎ|3)
with g positive definite. Symmetry and the triangle inequality are not required. The matrix g is a Riemannian metric.
Bregman divergence. For a smooth, strictly convex ψ on a convex domain,
Dψ[ΞΈ:ΞΈβ€²]=ψ(ΞΈ)βˆ’Οˆ(ΞΈβ€²)βˆ’βˆ‡Οˆ(ΞΈβ€²)β‹…(ΞΈβˆ’ΞΈβ€²),
the height of the graph of ψ at ΞΈ above the tangent plane at ΞΈβ€². Its metric is the Hessian, gij=βˆ‚iβˆ‚jψ.
Legendre transform. Put Ξ·=βˆ‡Οˆ(ΞΈ). Strict convexity makes θ↦η one-to-one, and
Οˆβˆ—(Ξ·)=supΞΈ(ΞΈβ‹…Ξ·βˆ’Οˆ(ΞΈ))=ΞΈβ‹…Ξ·βˆ’Οˆ(ΞΈ),ΞΈ=βˆ‡Οˆβˆ—(Ξ·).
Οˆβˆ— is again convex, and its Hessian at Ξ· is the inverse of the Hessian of ψ at ΞΈ.
Duality. For any ΞΈ and Ξ·β€²=βˆ‡Οˆ(ΞΈβ€²),
Dψ[ΞΈ:ΞΈβ€²]=ψ(ΞΈ)+Οˆβˆ—(Ξ·β€²)βˆ’ΞΈβ‹…Ξ·β€²=DΟˆβˆ—[Ξ·β€²:Ξ·].
The same number is a gap under ψ and a gap under Οˆβˆ—, with the order of the points reversed.

So a convex function gives two coordinate systems, ΞΈ and Ξ·, and a divergence that looks like "half a squared distance" up close. The rest of Chapter 1 shows that straight lines in ΞΈ and straight lines in Ξ· behave like two kinds of geodesic, and a Pythagorean theorem holds when they meet at a right angle. Below, the left plot is ψ and the right plot is Οˆβˆ—.

Explore

Convex function ψ(θ)
ψ(ΞΈ). Drag the points ΞΈ and ΞΈβ€² sideways. Dψ[ΞΈ:ΞΈβ€²] Dψ[ΞΈβ€²:ΞΈ]
Οˆβˆ—(Ξ·), the same two points in the dual coordinate Ξ·=Οˆβ€²(ΞΈ). You can drag here too.

Worked example

Take ψ(ΞΈ)=eΞΈ on R. Find the dual coordinate and the dual function, write Dψ in terms of Ξ»=eΞΈ, and compute both orders for Ξ»=1,Β Ξ»β€²=2.

  1. What are Ξ· and Οˆβˆ—(Ξ·)?

    Ξ·=Οˆβ€²(ΞΈ)=eΞΈ=Ξ», so Ξ·>0 and ΞΈ=log⁑η. Then

    Οˆβˆ—(Ξ·)=ΞΈΞ·βˆ’Οˆ(ΞΈ)=Ξ·logβ‘Ξ·βˆ’Ξ·.
  2. Write Dψ[ΞΈ:ΞΈβ€²] in terms of Ξ»,Ξ»β€².

    Dψ[ΞΈ:ΞΈβ€²]=eΞΈβˆ’eΞΈβ€²βˆ’eΞΈβ€²(ΞΈβˆ’ΞΈβ€²)=Ξ»βˆ’Ξ»β€²+Ξ»β€²log⁑λ′λ.

    This is the KL divergence from the Poisson distribution with mean Ξ»β€² to the one with mean Ξ». (eΞΈ is the log-partition function of the Poisson family, which is why the explorer labels it that way.)

  3. Check the duality formula using Οˆβˆ—.

    DΟˆβˆ—[Ξ»β€²:Ξ»]=Οˆβˆ—(Ξ»β€²)βˆ’Οˆβˆ—(Ξ»)βˆ’(log⁑λ)(Ξ»β€²βˆ’Ξ»)=Ξ»β€²logβ‘Ξ»β€²βˆ’Ξ»β€²βˆ’Ξ»log⁑λ+Ξ»βˆ’Ξ»β€²log⁑λ+Ξ»log⁑λ,

    which simplifies to Ξ»βˆ’Ξ»β€²+Ξ»β€²log⁑(Ξ»β€²/Ξ»), the same expression.

  4. Evaluate both orders for Ξ»=1,Ξ»β€²=2.

    Dψ[ΞΈ:ΞΈβ€²]=1βˆ’2+2log⁑2β‰ˆ0.386 and Dψ[ΞΈβ€²:ΞΈ]=2βˆ’1+1β‹…log⁑12β‰ˆ0.307. The two orders differ. Choose eΞΈ in the explorer: it starts at ΞΈ=0, ΞΈβ€²=log⁑2β‰ˆ0.69, and shows both gaps.

Check your understanding

For ψ(ΞΈ)=12|ΞΈ|2 on Rn, what is Dψ[ΞΈ:ΞΈβ€²]?

  1. 12|ΞΈβˆ’ΞΈβ€²|2
  2. |ΞΈβˆ’ΞΈβ€²|A divergence behaves like half a squared distance near the diagonal, not like a distance. Expand the definition.
  3. ΞΈβ‹…ΞΈβ€²That can be negative, and a divergence never is.
12|ΞΈ|2βˆ’12|ΞΈβ€²|2βˆ’ΞΈβ€²β‹…(ΞΈβˆ’ΞΈβ€²)=12|ΞΈβˆ’ΞΈβ€²|2. Here Ξ·=ΞΈ and Οˆβˆ—=ψ: 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ψ[ΞΈ:ΞΈβ€²]β‰₯0That always holds: a convex function lies above each of its tangent planes.
  2. Convexity in the first argument θAs a function of θ it is ψ minus an affine function, so it is convex.
  3. Symmetry, Dψ[ΞΈ:ΞΈβ€²]=Dψ[ΞΈβ€²:ΞΈ]
The gap at ΞΈ under the tangent at ΞΈβ€² and the gap at ΞΈβ€² under the tangent at ΞΈ are different lengths unless ψ curves the same way everywhere between them. In the explorer the red and gold gaps differ for every ψ except ΞΈ2/2. It is also usually not convex in its second argument.

ψ has second derivative Οˆβ€³(ΞΈ)=g at some ΞΈ. What is (Οˆβˆ—)β€³ at Ξ·=Οˆβ€²(ΞΈ)?

  1. 1/g
  2. gTest it on ψ=eΞΈ: Οˆβ€³=eΞΈ=Ξ·, while Οˆβˆ—=Ξ·logβ‘Ξ·βˆ’Ξ· has (Οˆβˆ—)β€³=1/Ξ·.
  3. βˆ’gΟˆβˆ— is a supremum of affine functions of Ξ·, so it is convex too.
(Οˆβˆ—)β€²(Ξ·)=ΞΈ(Ξ·) is the inverse function of Ξ·(ΞΈ)=Οˆβ€²(ΞΈ), so its derivative is 1/Οˆβ€³(ΞΈ). In several variables the Hessians are inverse matrices: the metric written in Ξ·-coordinates is the inverse of the metric in ΞΈ-coordinates.

Practice

The Bernoulli potentialA Legendre pair and a KL divergence

Let ψ(ΞΈ)=log⁑(1+eΞΈ). Find Ξ· and Οˆβˆ—(Ξ·), and show that Dψ[ΞΈ:ΞΈβ€²] is the KL divergence βˆ‘xpβ€²(x)log⁑pβ€²(x)p(x) between the Bernoulli distributions with success probabilities Ξ·β€² and Ξ·.

Hint

Ξ· is the logistic function of ΞΈ, and Οˆβˆ— turns out to be minus an entropy. Use Οˆβˆ— and the duality formula rather than ψ directly.

Solution

Ξ·=eΞΈ/(1+eΞΈ), so ΞΈ=log⁑η1βˆ’Ξ· and ψ(ΞΈ)=βˆ’log⁑(1βˆ’Ξ·). Then Οˆβˆ—(Ξ·)=ΞΈΞ·βˆ’Οˆ=Ξ·log⁑η+(1βˆ’Ξ·)log⁑(1βˆ’Ξ·). By duality

Dψ[ΞΈ:ΞΈβ€²]=ψ(ΞΈ)+Οˆβˆ—(Ξ·β€²)βˆ’ΞΈΞ·β€²=βˆ’log⁑(1βˆ’Ξ·)+Ξ·β€²log⁑η′+(1βˆ’Ξ·β€²)log⁑(1βˆ’Ξ·β€²)βˆ’Ξ·β€²log⁑η1βˆ’Ξ·,

which rearranges to Ξ·β€²log⁑η′η+(1βˆ’Ξ·β€²)log⁑1βˆ’Ξ·β€²1βˆ’Ξ·.

The three-point identityWhere the Pythagorean theorem comes from

Writing Ξ·=βˆ‡Οˆ(ΞΈ) and similarly for primed points, show that for any three points

Dψ[ΞΈ:ΞΈβ€³]=Dψ[ΞΈ:ΞΈβ€²]+Dψ[ΞΈβ€²:ΞΈβ€³]βˆ’(ΞΈβˆ’ΞΈβ€²)β‹…(Ξ·β€³βˆ’Ξ·β€²).

When does the last term vanish?

Solution

Expand all three divergences with the definition. The ψ(ΞΈβ€²) terms cancel, and collecting the inner products leaves exactly βˆ’(ΞΈβˆ’ΞΈβ€²)β‹…(Ξ·β€³βˆ’Ξ·β€²). It vanishes when the vector from ΞΈβ€² to ΞΈ, written in ΞΈ-coordinates, is orthogonal to the vector from ΞΈβ€² to ΞΈβ€³, written in Ξ·-coordinates. Because ΞΈ and Ξ· are dual, this pairing is the Riemannian inner product at ΞΈβ€². 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)βˆ’Οˆ(ΞΈ)) with respect to a fixed base measure. The log-partition function ψ is convex, Ξ·=βˆ‡Οˆ(ΞΈ)=EΞΈ[t(x)], and βˆ‡2ψ(ΞΈ)=CovΞΈ[t(x)] is the Fisher information. So Module 1 applies with ψ the log-partition function, and its Bregman divergence is a KL divergence: Dψ[ΞΈ:ΞΈβ€²]=KL[pΞΈβ€²:pΞΈ], where KL[p:q]=βˆ‘xp(x)log⁑p(x)q(x).
Mixture family. p(x,Ξ·)=βˆ‘iΞ·ipi(x)+(1βˆ’βˆ‘iΞ·i)p0(x): linear in its parameters. The distributions on n+1 outcomes, the simplex Sn, are both: ΞΈi=log⁑(pi/p0) makes it exponential and Ξ·i=pi makes it a mixture family.
Two geodesics. Between p and q, the m-geodesic is pt=(1βˆ’t)p+tq. The e-geodesic is log⁑pt=(1βˆ’t)log⁑p+tlog⁑qβˆ’c(t), that is pt∝p1βˆ’tqt. 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 P to Q and the e-geodesic from Q to R are orthogonal at Q in the Fisher metric, then
KL[P:R]=KL[P:Q]+KL[Q:R].
Projection theorem. Let M be m-flat and R any distribution. The point Q∈M minimizing KL[Q:R] is unique, and it is where an e-geodesic from R meets M orthogonally (the e-projection). For every P∈M, KL[P:R]=KL[P:Q]+KL[Q:R].

The maximum entropy principle is the special case where R is uniform: 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} with mean 10/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/7 form an m-flat set M (a linear constraint). Maximizing entropy over M is e-projecting the uniform distribution u onto M, so the answer lies on an e-geodesic from u that meets M orthogonally. The e-geodesics through u are qx∝eΞ»v(x), and orthogonality to every direction inside M (changes Ξ΄p with βˆ‘Ξ΄px=0 and βˆ‘xΞ΄px=0) forces v to be affine in x. So qx∝eΞ»x, that is, q=(1,r,r2)/(1+r+r2) with r=eΞ».

  2. Solve for r.

    The mean is r+2r21+r+r2=107, so 7r+14r2=10+10r+10r2, that is 4r2βˆ’3rβˆ’10=0, with positive root r=2. Hence q=(1,2,4)/7.

  3. Compute H(q).

    log⁑qx=xlog⁑2βˆ’log⁑7, so H(q)=log⁑7βˆ’107log⁑2β‰ˆ0.956 nats (against log⁑3β‰ˆ1.099 for the uniform distribution).

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

    Since log⁑qx is affine in x, βˆ‘xpxlog⁑qx depends on p only through its mean, so it equals βˆ‘xqxlog⁑qx=βˆ’H(q). Therefore 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].

    Numerically H(p)β‰ˆ0.598, so KL[p:q]β‰ˆ0.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) and q=(0.1,0.1,0.8). Which is the midpoint of the e-geodesic between them?

  1. (0.45,0.10,0.45)That is the m-midpoint, the average of the probabilities.
  2. (0.425,0.150,0.425)
  3. (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), which sums to 0.666; dividing gives (0.425,0.150,0.425). The geometric mean punishes disagreement, so the outcome on which p and q agree gains weight.

Q is the e-projection of R onto an m-flat set M, and P is another point of M. Which is guaranteed?

  1. KL[P:R]β‰₯KL[Q:R], with equality only if P=Q
  2. KL[R:P]β‰₯KL[R:Q]The order matters. The e-projection minimizes KL[β‹…:R], with the point of M first. Minimizing KL[R:β‹…] is a different projection.
  3. KL[P:Q]=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] and KL[P:Q]>0 for P≠Q. That is why the e-projection is the unique minimizer. Switch the explorer to "Projection" and slide P along the line.

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

  1. {p:p1=2p3}
  2. {p:p1βˆ’p3=0.2}It is linear in p, so m-flat. But the e-midpoint of (0.5,0.2,0.3) and (0.3,0.6,0.1) has p1βˆ’p3β‰ˆ0.236.
  3. {p:p1p3=p22}In logarithms it reads log⁑p1+log⁑p3βˆ’2log⁑p2=0, which is linear in ΞΈ, so it is e-flat. Is the m-midpoint of (13,13,13) and (47,27,17) in it?
p1=2p3 is linear in p (m-flat), and it is equivalent to log⁑p1βˆ’log⁑p3=log⁑2, which is linear in ΞΈi=log⁑(pi/p0) (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βˆ’x, x∈{0,1}, as an exponential family. Find ΞΈ, ψ(ΞΈ), and the Fisher information in the coordinate ΞΈ and in the coordinate Ξ·.

Solution

log⁑p=xlog⁑η1βˆ’Ξ·+log⁑(1βˆ’Ξ·), so t(x)=x, ΞΈ=log⁑η1βˆ’Ξ· and ψ(ΞΈ)=log⁑(1+eΞΈ). In ΞΈ: g=Οˆβ€³(ΞΈ)=Ξ·(1βˆ’Ξ·), the variance of x. In Ξ·: g=1/(Ξ·(1βˆ’Ξ·)), the inverse, as Module 1 predicts.

Mutual information as a projectionProjecting onto independent distributions

Let p(x,y) be a joint distribution on a finite set, with marginals pX,pY. Show that among all product distributions q1(x)q2(y) (an e-flat set), KL[p:q1q2] is minimized by q1=pX,Β q2=pY, and the minimum is the mutual information I(X;Y).

Hint

Split log⁑q1(x)q2(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) =βˆ’H(X,Y)+H(X)+KL[pX:q1]+H(Y)+KL[pY:q2]. The two KL terms vanish exactly when q1=pX, q2=pY, leaving 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 f on (0,∞) with f(1)=0 and fβ€³(1)=1,
Df[p:q]=βˆ‘ipif(qipi).
f(u)=βˆ’log⁑u gives KL[p:q]; f(u)=ulog⁑u gives KL[q:p]; f(u)=2(uβˆ’1)2 gives 2βˆ‘i(piβˆ’qi)2.
Coarse graining. Merge the outcomes into blocks A1,…,Am: pΒ―j=βˆ‘i∈Ajpi. The merge is sufficient for p,q if qi/pi is constant on each block: then nothing that distinguishes p from q is lost.
Information monotonicity. Df[pΒ―:qΒ―]≀Df[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) that is monotone in this sense is an f-divergence (up to a constant factor). A Riemannian metric on Sn that is invariant under sufficient embeddings is a constant multiple of the Fisher metric
gij(ΞΎ)=EΞΎ[βˆ‚ilog⁑p(x,ΞΎ)Β βˆ‚jlog⁑p(x,ΞΎ)],ds2=βˆ‘idpi2piΒ Β onΒ Sn.

Every f-divergence with fβ€³(1)=1 has this same metric, Df[p:p+dp]β‰ˆ12βˆ‘idpi2/pi. The substitution ΞΎi=2pi turns ds2 into βˆ‘dΞΎi2 and Sn into part of a sphere of radius 2, so the Fisher distance is d(p,q)=2arccosβ‘βˆ‘ipiqi. Below, compare the level sets of KL[P:β‹…], KL[β‹…:P] and 12d2: they agree near P 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) and q=(0.2,0.3,0.5). Merge outcomes 2 and 3 and compare KL divergences before and after; then change q so that the merge loses nothing.

  1. Compute KL[p:q].

    0.5log⁑2.5+0.3log⁑1+0.2log⁑0.4β‰ˆ0.458+0βˆ’0.183=0.275.

  2. Compute KL[pΒ―:qΒ―] for pΒ―=(0.5,0.5), qΒ―=(0.2,0.8).

    0.5log⁑2.5+0.5log⁑0.625β‰ˆ0.458βˆ’0.235=0.223. Smaller, as monotonicity demands.

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

    On the merged block the ratios are q2/p2=1 and q3/p3=2.5. They differ, so the merged block mixes evidence that pointed in different directions. The loss is pΒ―2 times a KL divergence of the within-block conditionals: 0.5KL[(0.6,0.4):(0.375,0.625)]β‰ˆ0.052, and indeed 0.275βˆ’0.223=0.052.

  4. Keep q1=0.2 and choose q2,q3 so the merge is sufficient. What is KL[p:q] now?

    We need q2/q3=p2/p3=3/2 with q2+q3=0.8, so 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, 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]Take f(u)=ulog⁑u: βˆ‘piqipilog⁑qipi=βˆ‘qilog⁑qipi.
  2. 2βˆ‘i(piβˆ’qi)2Take f(u)=2(uβˆ’1)2.
  3. βˆ‘i(piβˆ’qi)2
Split one outcome into k equally likely copies. That refinement is sufficient, so an invariant divergence must not change. But the squared Euclidean distance replaces (aβˆ’b)2 by k(a/kβˆ’b/k)2=(aβˆ’b)2/k. An f-divergence depends only on the ratios qi/pi, which splitting leaves alone.

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

  1. q=(0.2,0.4,0.4)The ratios on the merged block are 1 and 2: the merge throws away the difference between them.
  2. q=(0.1,0.6,0.3)
  3. q=(0.4,0.2,0.4)Ratios 0.5 and 2 on the merged block. Not sufficient.
Here q2/p2=q3/p3=1.5, so within the merged block q is just a rescaled copy of p: 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)=1 agree with 12ds2 to second order. So when Q is close to P, how big is KL[P:Q]βˆ’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, 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) for p and p+dp in the simplex.

Hint

Write qi/pi=1+ui with ui=dpi/pi, expand f around 1, and use βˆ‘idpi=0.

Solution

f(1+u)=fβ€²(1)u+12fβ€³(1)u2+O(u3). Summing pif(1+ui): the linear term is fβ€²(1)βˆ‘idpi=0, and the quadratic term is 12fβ€³(1)βˆ‘ipiui2=12fβ€³(1)βˆ‘idpi2/pi.

Fisher distance through the sphereA closed form

Show that ΞΎi=2pi sends the simplex into the sphere |ΞΎ|=2 and turns βˆ‘dpi2/pi into βˆ‘dΞΎi2. Deduce d(p,q)=2arccosβ‘βˆ‘ipiqi, and evaluate it for p=(12,12), q=(0.9,0.1).

Solution

βˆ‘ΞΎi2=4βˆ‘pi=4 and dΞΎi=dpi/pi, so dΞΎi2=dpi2/pi. Distances on a sphere of radius 2 are 2Γ—(angle), and cos⁑(angle)=ΞΎβ‹…ΞΎβ€²/4=βˆ‘piqi. (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, so dβ‰ˆ2Γ—0.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 Ξ±, with Ξ± and βˆ’Ξ± always dual to each other.

The idea

Ξ±-representation. β„“Ξ±(u)=21βˆ’Ξ±u(1βˆ’Ξ±)/2 for Ξ±β‰ 1, and β„“1(u)=log⁑u. So Ξ±=βˆ’1 is u itself (m), Ξ±=1 is log⁑u (e), and Ξ±=0 is 2u.
Ξ±-divergence. For positive vectors m,n and Ξ±β‰ Β±1,
DΞ±[m:n]=41βˆ’Ξ±2βˆ‘i(1βˆ’Ξ±2mi+1+Ξ±2niβˆ’mi(1βˆ’Ξ±)/2ni(1+Ξ±)/2).
As Ξ±β†’βˆ’1 it tends to βˆ‘i(milog⁑miniβˆ’mi+ni), the KL divergence, and as Ξ±β†’1 to the same with m,n swapped. Always DΞ±[m:n]=Dβˆ’Ξ±[n:m]. It is the f-divergence with f(u)=41βˆ’Ξ±2(1βˆ’u(1+Ξ±)/2)+21βˆ’Ξ±(uβˆ’1).
Ξ±-geodesic. On positive measures it is the straight line in β„“Ξ±: mi(t)(1βˆ’Ξ±)/2=(1βˆ’t)mi(1βˆ’Ξ±)/2+tni(1βˆ’Ξ±)/2. On the simplex, rescale p(t) to sum to 1. For Ξ±=0 this is the great-circle arc of Module 3.
Pythagoras, with a correction. Positive measures are Ξ±-flat for every Ξ±, and the Pythagorean theorem holds exactly there. The simplex is flat only for Ξ±=Β±1. For other Ξ±, when the Ξ±-geodesic pq and the (βˆ’Ξ±)-geodesic qr are orthogonal,
DΞ±[p:r]=DΞ±[p:q]+DΞ±[q:r]βˆ’1βˆ’Ξ±24DΞ±[p:q]DΞ±[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)): arithmetic for Ξ±=βˆ’1, geometric for Ξ±=1, harmonic for Ξ±=3. Tsallis's q-logarithm lnq⁑u=(u1βˆ’qβˆ’1)/(1βˆ’q) is the Ξ±-representation shifted by a constant, with q=(1+Ξ±)/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=1 and b=4 for several Ξ±, and find its limits as Ξ±β†’Β±βˆž.

  1. Write mΞ±(a,b) explicitly for Ξ±β‰ 1.

    With r=(1βˆ’Ξ±)/2, the constant 2/(1βˆ’Ξ±) cancels and mΞ±(a,b)=(ar+br2)1/r: a power mean with exponent r.

  2. Evaluate it for Ξ±=βˆ’1,0,1,3.

    Ξ±=βˆ’1 (r=1): 2.5. Ξ±=0 (r=12): (1+22)2=2.25. Ξ±=1 (the limit rβ†’0): 1β‹…4=2. Ξ±=3 (r=βˆ’1): (1+1/42)βˆ’1=1.6.

  3. What happens as Ξ±β†’βˆ’βˆž and Ξ±β†’+∞?

    rβ†’+∞: the power mean tends to max(a,b)=4. rβ†’βˆ’βˆž: it tends to min(a,b)=1. So Ξ± slides the mean continuously and monotonically from optimistic (max) to pessimistic (min).

  4. Connect this to the explorer.

    Before rescaling, the Ξ±-geodesic midpoint of P and Q is their Ξ±-mean taken coordinate by coordinate. For large Ξ± each coordinate is pulled toward the smaller of pi,qi, so after rescaling the midpoint gives more weight to outcomes on which P and Q agree. For very negative Ξ± the larger value wins and the midpoint spreads toward both of their favourite outcomes. Put P and Q near different corners and move Ξ± from βˆ’3 to 3.

Check your understanding

For which Ξ± is DΞ± symmetric in its two arguments?

  1. Ξ±=0
  2. Ξ±=1D1[p:q]=KL[q:p], which is not symmetric.
  3. Every Ξ±Use the duality DΞ±[p:q]=Dβˆ’Ξ±[q:p]: symmetry needs DΞ±=Dβˆ’Ξ±.
Duality gives DΞ±[p:q]=Dβˆ’Ξ±[q:p], so D0 is self-dual and symmetric. It equals 2βˆ‘(piβˆ’qi)2 on the simplex. Set Ξ±=0 above: the two readings coincide.

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

  1. Only Ξ±=Β±1
  2. Only Ξ±=0At Ξ±=0 the correction factor (1βˆ’Ξ±2)/4 is largest: the simplex is a piece of a sphere for that geometry.
  3. Every Ξ±That is true for positive measures, which are Ξ±-flat for every Ξ±. The simplex is a curved slice of them.
The correction term carries the factor 1βˆ’Ξ±2, which vanishes only at Ξ±=Β±1: the e- and m-geometries, in which the simplex is dually flat.

As Ξ± increases from βˆ’1 to 1, the Ξ±-mean of 1 and 4…

  1. decreases from 2.5 to 2
  2. increases from 2 to 2.5Ξ±=βˆ’1 is the arithmetic mean, the larger one.
  3. stays at 2.5Only when a=b do all the means agree.
The exponent r=(1βˆ’Ξ±)/2 falls from 1 to 0, and power means increase with their exponent. On the way, Ξ±=0 gives 2.25.

Practice

Ξ± = 0 is a function of the Fisher distanceHellinger and the sphere

Show that on the simplex D0[p:q]=8sin2⁑(d/4), where d=2arccosβ‘βˆ‘ipiqi is the Fisher distance.

Solution

For probability vectors the first two terms of D0 sum to 1, so D0=4(1βˆ’βˆ‘piqi)=4(1βˆ’cos⁑(d/2))=8sin2⁑(d/4). So D0 is an increasing function of the Fisher distance, and D0β‰ˆd2/2 for small d.

A divergence for covariance matricesInvariance under change of basis

On positive-definite nΓ—n matrices take ψ(P)=βˆ’log⁑detP. Show that its Bregman divergence is D[P:Q]=tr(PQβˆ’1)βˆ’log⁑det(PQβˆ’1)βˆ’n, that it is unchanged by P↦ATPA, Q↦ATQA for invertible A, and what it becomes for diagonal matrices.

Hint

The gradient of log⁑det at Q is Qβˆ’1, in the sense dlog⁑detQ=tr(Qβˆ’1dQ).

Solution

D=βˆ’log⁑detP+log⁑detQ+tr(Qβˆ’1(Pβˆ’Q)), which is the stated formula. Under the change of basis PQβˆ’1↦ATPQβˆ’1Aβˆ’T, a similar matrix, so trace and determinant are unchanged. For diagonal matrices it is βˆ‘i(pi/qiβˆ’log⁑(pi/qi)βˆ’1), a sum of Itakura–Saito divergences. It is also twice the KL divergence between the zero-mean Gaussians with covariances P and Q.

InteractiveAmari, Ch. 5: Elements of Differential Geometry

The Fisher metric on Gaussians

The normal distributions N(ΞΌ,Οƒ2) form a surface, the upper half-plane. With the Fisher metric it is a hyperbolic plane: distances blow up as Οƒβ†’0, and the shortest path between two narrow distributions with different means goes through wider ones.

The idea

Riemannian metric. An inner product gij(ΞΎ) on each tangent space. A curve ΞΎ(t) has length ∫gijΞΎΛ™iΞΎΛ™jdt, 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 g; its geodesics are locally the shortest curves. Curvature measures how parallel transport around a small loop rotates vectors.
The normal family. For N(ΞΌ,Οƒ2) the Fisher metric is
ds2=dμ2+2dσ2σ2.
With u=ΞΌ/2 this is 2(du2+dΟƒ2)/Οƒ2: twice the PoincarΓ© half-plane metric, a surface of constant curvature βˆ’12.

So geodesics are the hyperbolic ones: vertical lines, and half-circles centred on Οƒ=0 in the (u,Οƒ) plane, which are half-ellipses (ΞΌβˆ’c)2/2+Οƒ2=R2 in (ΞΌ,Οƒ). The distance is

d=2arccosh(1+(ΞΌ1βˆ’ΞΌ2)2/2+(Οƒ1βˆ’Οƒ2)22Οƒ1Οƒ2).

Explore

The (ΞΌ,Οƒ) 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), then find the Fisher distance from N(βˆ’1,1) to N(1,1) and compare it with the path that keeps Οƒ=1.

  1. Compute the two score functions.

    log⁑p=βˆ’logβ‘Οƒβˆ’(xβˆ’ΞΌ)22Οƒ2+const. With z=(xβˆ’ΞΌ)/Οƒ, βˆ‚ΞΌlog⁑p=z/Οƒ and βˆ‚Οƒlog⁑p=(z2βˆ’1)/Οƒ.

  2. Take expectations of their products.

    z is standard normal: Ez2=1, Ez(z2βˆ’1)=0, E(z2βˆ’1)2=Ez4βˆ’2Ez2+1=2. So gΞΌΞΌ=1/Οƒ2, gΞΌΟƒ=0, gσσ=2/Οƒ2.

  3. Find the length of the horizontal path Οƒ=1 from ΞΌ=βˆ’1 to ΞΌ=1, and the geodesic distance.

    Along Οƒ=1, ds=dΞΌ, so the length is 2. The formula gives d=2arccosh⁑(1+22)=2arccosh⁑2β‰ˆ1.862. The horizontal path is not a geodesic.

  4. Which distributions does the geodesic pass through?

    In (u,Οƒ) the endpoints are (βˆ“1/2,1), so the circle is centred at u=0 with radius 1/2+1β‰ˆ1.225. The geodesic rises to N(0,1.2252) 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,0.52) or N(0,22)?

  1. N(0,22), because σ changes by 1 rather than 0.5The metric is 2dσ/σ along vertical lines: what counts is the ratio of the σ's, not their difference.
  2. N(0,0.52), 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 the distance is ∫2dΟƒ/Οƒ=2|log⁑(Οƒ2/Οƒ1)|, which is 2log⁑2β‰ˆ0.980 for both. Doubling x is an invertible change of units, so it preserves the Fisher geometry, and it maps N(0,0.52)↦N(0,1) and N(0,1)↦N(0,22).

The geodesic between N(βˆ’a,Οƒ2) and N(a,Οƒ2) passes through…

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

We switch coordinates from (ΞΌ,Οƒ) to (ΞΌ,v) with v=Οƒ2. What happens to the Fisher distance between two given normal distributions?

  1. Nothing; only the formula for gij changes
  2. It changes, since gvvβ‰ gσσThe components change, but so do the coordinate differentials, and ds2 is the same quadratic form.
  3. It is multiplied by 2Lengths of curves are defined without reference to coordinates.
dσ=dv/(2v), so 2dσ2/σ2=dv2/(2v2): gvv=1/(2v2), a different number, but the same ds2. 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 has Gaussian curvature βˆ’1, show that the Fisher metric of the normal family has curvature βˆ’12.

Solution

Multiplying a metric by a constant c multiplies all lengths by c and areas by c. Gaussian curvature is angle excess per unit area (Gauss–Bonnet), and angles do not change, so K is divided by c. With c=2, K=βˆ’12.

A one-dimensional familyDistance in the exponential family of rates

For the exponential distributions p(x;Ξ»)=Ξ»eβˆ’Ξ»x, x>0, compute the Fisher information g(Ξ») and the Fisher distance between rates Ξ»1 and Ξ»2.

Solution

βˆ‚Ξ»log⁑p=1/Ξ»βˆ’x, with variance Var(x)=1/Ξ»2. So g=1/Ξ»2 and d=∫λ1Ξ»2dΞ»/Ξ»=|log⁑(Ξ»2/Ξ»1)|. Again only ratios matter, because changing the unit of x 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. βˆ‡ and βˆ‡βˆ— are dual with respect to g if X⟨Y,Z⟩=βŸ¨βˆ‡XY,Z⟩+⟨Y,βˆ‡Xβˆ—Z⟩. Equivalently, transporting one vector by βˆ‡ and another by βˆ‡βˆ— keeps their inner product constant. A connection is self-dual exactly when it preserves g, like the Levi-Civita connection.
The Ξ±-connections. With the cubic (Amari–Chentsov) tensor Tijk=E[βˆ‚iβ„“βˆ‚jβ„“βˆ‚kβ„“], β„“=log⁑p, define Ξ“ijk(Ξ±)=Ξ“ijk(0)βˆ’Ξ±2Tijk, where Ξ“(0) is Levi-Civita. Then βˆ‡(Ξ±) and βˆ‡(βˆ’Ξ±) are dual; Ξ±=1 is the e-connection, Ξ±=βˆ’1 the m-connection, and their average is Levi-Civita. Any divergence produces such a pair: its second derivatives give g, its third derivatives give the two connections.
Dually flat manifolds. If βˆ‡ is flat with affine coordinates ΞΈ, then βˆ‡βˆ— is flat too, with affine coordinates Ξ·=βˆ‡Οˆ(ΞΈ) for a convex potential ψ. The canonical divergence is the Bregman divergence of Module 1, and the Pythagorean theorem holds. Exponential families are dually flat: ΞΈ natural parameters, Ξ· expectation parameters.

For N(ΞΌ,Οƒ2): ΞΈ=(ΞΌ/Οƒ2,βˆ’1/(2Οƒ2)), Ξ·=(ΞΌ,Β ΞΌ2+Οƒ2). The e-geodesic is a straight line in ΞΈ, the m-geodesic a straight line in Ξ·, and the Levi-Civita geodesic is the hyperbolic one from Module 5. Mixing the two systems also works: coordinates such as (Ξ·1,ΞΈ2) cut a dually flat manifold into two families of flat slices that meet orthogonally.

Explore

e-geodesic m-geodesic Levi-Civita geodesic. Axes ΞΌ (across) and Οƒ (up).
Show

Worked example

Write the normal family in natural parameters, find its potential ψ, check that βˆ‡Οˆ gives Ξ·, and find the dual potential Οˆβˆ—.

  1. Put log⁑p in the form ΞΈβ‹…t(x)βˆ’Οˆ(ΞΈ).

    log⁑p=ΞΌΟƒ2xβˆ’12Οƒ2x2βˆ’ΞΌ22Οƒ2βˆ’12log⁑(2πσ2). So t=(x,x2), ΞΈ1=ΞΌ/Οƒ2, ΞΈ2=βˆ’1/(2Οƒ2), and in terms of ΞΈ

    ψ(ΞΈ)=βˆ’ΞΈ124ΞΈ2+12log⁑(βˆ’Ο€ΞΈ2).
  2. Differentiate ψ.

    βˆ‚1ψ=βˆ’ΞΈ1/(2ΞΈ2)=ΞΌ and βˆ‚2ψ=ΞΈ12/(4ΞΈ22)βˆ’1/(2ΞΈ2)=ΞΌ2+Οƒ2. These are E[x] and E[x2], as they must be.

  3. Compute Οˆβˆ—(Ξ·)=ΞΈβ‹…Ξ·βˆ’Οˆ(ΞΈ).

    ΞΈβ‹…Ξ·=ΞΌ2Οƒ2βˆ’ΞΌ2+Οƒ22Οƒ2=ΞΌ22Οƒ2βˆ’12, and ψ=ΞΌ22Οƒ2+12log⁑(2πσ2). So Οˆβˆ—=βˆ’12log⁑(2Ο€eΟƒ2), minus the entropy of N(ΞΌ,Οƒ2), with Οƒ2=Ξ·2βˆ’Ξ·12.

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

    Both endpoints have ΞΈ2=βˆ’12, so the e-geodesic keeps ΞΈ2 and hence Οƒ=1 fixed: it is the horizontal segment. Both have Ξ·2=2, so the m-geodesic keeps ΞΌ2+Οƒ2=2: it is an arc of the circle of radius 2, reaching Οƒ=2 at ΞΌ=0. The Levi-Civita geodesic lies between, peaking at Οƒβ‰ˆ1.225.

Check your understanding

What is the average 12(βˆ‡(1)+βˆ‡(βˆ’1)) of the e- and m-connections?

  1. The Levi-Civita connection of the Fisher metric
  2. The flat connection of the ΞΈ 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, 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), B=N(1,1). Which geodesic from A to B keeps Οƒ constant?

  1. The e-geodesic
  2. The m-geodesicThe m-geodesic averages Ξ·2=ΞΌ2+Οƒ2. In the middle ΞΌ2 is smaller, so Οƒ2 must be larger.
  3. The Levi-Civita geodesicThat one bends upward (Module 5).
ΞΈ2=βˆ’1/(2Οƒ2) is the same at both ends, and the e-geodesic is linear in ΞΈ. Place A and B at the same height to see it.

The m-geodesic from A to B and the e-geodesic from B to C are orthogonal at B. Which identity follows?

  1. KL[A:C]=KL[A:B]+KL[B:C]
  2. KL[C:A]=KL[C:B]+KL[B:A]That version needs the roles swapped: an m-geodesic from C to B orthogonal to an e-geodesic from B to A.
  3. The Fisher distances satisfy dAC2=dAB2+dBC2The half-plane is curved (K=βˆ’12), 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), the pairing that measures the angle at B.

Practice

Dual transport keeps inner productsBiorthogonal bases

In a dually flat manifold, let X have constant components in the ΞΈ basis βˆ‚/βˆ‚ΞΈi (e-parallel) and Y constant components in the Ξ· basis βˆ‚/βˆ‚Ξ·j (m-parallel). Show that ⟨X,Y⟩ is constant.

Hint

Compute βŸ¨βˆ‚/βˆ‚ΞΈi,βˆ‚/βˆ‚Ξ·j⟩ using βˆ‚Ξ·k/βˆ‚ΞΈi=gik.

Solution

βˆ‚/βˆ‚ΞΈi=βˆ‘kgikβˆ‚/βˆ‚Ξ·k, and the Ξ·-basis has inner products gkj (the inverse matrix). So βŸ¨βˆ‚ΞΈi,βˆ‚Ξ·j⟩=βˆ‘kgikgkj=Ξ΄ij. With X=aiβˆ‚ΞΈi, Y=bjβˆ‚Ξ·j, ⟨X,Y⟩=βˆ‘iaibi, which is constant when a and b are.

Mixed coordinates for two binary variablesMarginals and interaction

For p(x,y) on {0,1}2, use η1=P(x=1), η2=P(y=1) and θ12=log⁑p11p00p10p01. Show that independence is θ12=0, and explain why projecting p onto the independent distributions (minimizing KL[p:q]) keeps η1,η2 fixed.

Solution

p is a product exactly when its odds ratio is 1. Write log⁑p in the exponential form ΞΈ1x+ΞΈ2y+ΞΈ12xyβˆ’Οˆ; then ΞΈ12 is the log odds ratio, and {ΞΈ12=0} is e-flat. The sets of fixed marginals {Ξ·1,Ξ·2Β 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 p's marginals and lands at pXpY, 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)} sitting inside an exponential family S as a curve (or submanifold) Ξ·(u). After N observations the average of the sufficient statistics, Ξ·^=1Nβˆ‘kt(xk), is a point of S, usually not on M. It contains everything the data say about u.
Estimators and ancillary families. An estimator is a map u^=f(Ξ·^). Its level sets A(u)={Ξ·:f(Ξ·)=u} form the ancillary family. The estimator is consistent when each A(u) passes through Ξ·(u).
First-order efficiency. Asymptotically NVar(u^)β‰₯1/g(u), with g the Fisher information (CramΓ©r–Rao), and a consistent estimator attains 1/g(u) exactly when A(u) is orthogonal to M at Ξ·(u) in the Fisher metric.
The MLE is an m-projection. 1Nβˆ‘klog⁑p(xk,u)=ΞΈ(u)β‹…Ξ·^βˆ’Οˆ(ΞΈ(u)), so maximizing likelihood is minimizing KL[pΞ·^:pu] over M. The minimizer is where an m-geodesic from Ξ·^ meets M orthogonally, so the MLE's ancillary family is m-flat and orthogonal: the MLE is efficient.

Higher-order terms (bias, and the 1/N2 part of the variance) depend on how curved M and 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), whose standard deviation equals its mean, inside the normal family with Ξ·=(Ex,Ex2). True value u=1.

Explore

Axes Ξ·1=xΒ― (across) and Ξ·2=x2― (up). model Ξ·(u)=(u,2u2) the estimator's ancillary lines simulated Ξ·^'s. The grey region Ξ·2<Ξ·12 is impossible.
Estimator

Worked example

For N(u,u2), u>0: find the MLE, the Fisher information, and the asymptotic efficiency of xΒ―.

  1. Write the average log-likelihood in terms of m1=xΒ― and m2=x2―.

    1Nβ„“(u)=βˆ’log⁑uβˆ’m2βˆ’2um1+u22u2+const=βˆ’log⁑uβˆ’m22u2+m1u+const.

    Only (m1,m2)=Ξ·^ enters: it is sufficient.

  2. Solve the likelihood equation.

    βˆ’1u+m2u3βˆ’m1u2=0 gives u2+m1uβˆ’m2=0, so u^=12(βˆ’m1+m12+4m2). For fixed u the solutions form the line Ξ·2=uΞ·1+u2 through Ξ·(u)=(u,2u2): the MLE's ancillary family is a family of straight lines, as the theory says (m-flat).

  3. Compute the Fisher information g(u).

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

  4. What is the efficiency of xΒ―?

    Var(x¯)=u2/N, so its efficiency is u2/3Nu2/N=13. It ignores the information about u carried by the spread of the data. Its ancillary lines are vertical, at a Fisher angle of about 35∘ to the model instead of 90∘, and sin2⁑35.26∘=13.

Check your understanding

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

  1. Each A(u) passes through the model point Ξ·(u)
  2. Each A(u) is orthogonal to the modelThat is efficiency. A consistent estimator can cross at any angle.
  3. The lines A(u) are straightStraightness (m-flatness) matters for higher-order properties, not for consistency.
As Nβ†’βˆž, Ξ·^β†’Ξ·(u0) by the law of large numbers, so u^β†’f(Ξ·(u0)), which is u0 exactly when Ξ·(u0)∈A(u0). 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 Ξ·?

  1. Ξ·^ itself, which attains the CramΓ©r–Rao bound for every N
  2. It has to be found numericallyMaximizing ΞΈβ‹…Ξ·^βˆ’Οˆ(ΞΈ) gives βˆ‡Οˆ(ΞΈ)=Ξ·^ directly.
  3. Ξ·^, but it is biasedEΞ·^=Et(x)=Ξ·.
Ξ·^ is unbiased with covariance Cov(t)/N, and the Fisher information in Ξ·-coordinates is Cov(t)βˆ’1. So it is exactly efficient. Curving the model is what makes estimation subtle.

x2―/2 has efficiency 8/9 here. How many observations does it need to match the MLE with N=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 N.
Asymptotic variances are u2/(3N) for the MLE and 3u2/(8N) for this estimator. Equal variance needs Nβ€²=800Γ—3/81/3=900. Efficiency is a ratio of sample sizes.

Practice

Efficiency from the angleA Fisher inner product

At u=1, (x,x2) has covariance Ξ£=(1226), and the Fisher metric in Ξ·-coordinates is Ξ£βˆ’1. Compute the angle between the model tangent (1,4) and the vertical direction (0,1), and check that sin2 of it is 13.

Solution

Ξ£βˆ’1=12(6βˆ’2βˆ’21). Then ⟨t,t⟩=3, ⟨a,a⟩=12, ⟨t,a⟩=12(βˆ’2+4)=1. So cos2=13β‹…12=23 and sin2=13. The same computation with (1,1), the MLE direction, gives ⟨t,a⟩=12(6βˆ’2βˆ’8+4)=0.

The log-odds of a coinEfficiency in another parametrization

With N tosses of a coin with P(heads)=p, the MLE is p^, the frequency of heads. Find the asymptotic variance of the log-odds ΞΈ^=log⁑p^1βˆ’p^, and compare it with the CramΓ©r–Rao bound for ΞΈ.

Solution

dΞΈ/dp=1/(p(1βˆ’p)), so by the delta method Var(ΞΈ^)β‰ˆp(1βˆ’p)/N(p(1βˆ’p))2=1Np(1βˆ’p). The Fisher information for ΞΈ is Οˆβ€³(ΞΈ)=p(1βˆ’p), so this is the bound: the MLE stays efficient under reparametrization. (Only asymptotically: ΞΈ^ is infinite with positive probability for every finite N.)

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 x be observed and h hidden. The model manifold is M={p(x,h;ΞΎ)}. The data manifold is D={q(x,h):q(x)=p^(x)}, all joint distributions whose x-marginal is the empirical distribution. D 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;ΞΎ)].
Minimizing over q∈D kills the second term, and the first is βˆ’1Nlog⁑L(ΞΎ) plus a constant. So minq∈D,Β ΞΎKL[q:pΞΎ] is maximum likelihood.
E-step (e-projection onto D). For the current ξ, the minimizer over q∈D is q(x,h)=p^(x)p(h|x;ξ): fill in the hidden variable by its posterior.
M-step (m-projection onto M). Minimize KL[q:pξ] over ξ, that is, maximize Eq[log⁑p(x,h;ξ)]. For an exponential family this matches expected sufficient statistics.
Monotonicity. Neither step increases KL[q:pΞΎ], and right after each E-step it equals βˆ’1Nlog⁑L(ΞΎ)+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) with unknown means; the hidden variable is which component produced each point.

Watch

Data
The (a,b) plane: contours of the log-likelihood and the EM path. Drag the start point ΞΎβ‚€.
component a component b; dots below are the data, coloured by their posterior.
  1. The data, and a first guess ΞΎ0=(a,b) for the two means.
  2. E-step: give each point its posterior probability of coming from each component (e-projection onto D).
  3. M-step: move each mean to the posterior-weighted average of the data (m-projection onto M).
  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=b.

Worked example

Data x=(βˆ’2,Β 0,Β 3), model 12N(a,1)+12N(b,1), start at a=βˆ’1,Β b=1. Do one EM iteration by hand.

  1. Find the posterior rk=P(h=b∣xk) as a function of xk.

    r=eβˆ’(xβˆ’b)2/2eβˆ’(xβˆ’a)2/2+eβˆ’(xβˆ’b)2/2=11+e((xβˆ’b)2βˆ’(xβˆ’a)2)/2. With a=βˆ’1,b=1, (xβˆ’b)2βˆ’(xβˆ’a)2=βˆ’4x, so r=1/(1+eβˆ’2x).

  2. Evaluate the posteriors.

    r=(0.018,Β 0.5,Β 0.998) for x=βˆ’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.
  4. Check that the log-likelihood went up.

    βˆ‘klog⁑(12Ο•(xkβˆ’a)+12Ο•(xkβˆ’b)) is about βˆ’7.12 at (βˆ’1,1) and βˆ’6.18 at (βˆ’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)} is…

  1. m-flat
  2. e-flatFixing a marginal is a linear condition on q, not on log⁑q. The normalized geometric mean of two members can have a different marginal.
  3. neitherMix two members: (1βˆ’t)q+tqβ€² still has marginal p^.
The marginal is linear in q, so mixtures of members are members. That is why the E-step is an e-projection onto D: 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=b. What happens?

  1. It stays on the diagonal and converges to a=b=xΒ―, a saddle point
  2. It leaves the diagonal at once, because the likelihood is higher elsewhereEM is deterministic, and with a=b every posterior is exactly 12. Nothing breaks the symmetry.
  3. It fails, because the M-step divides by zeroEach component gets total weight N/2, so the weighted averages are defined.
With a=b, both components get posterior 12 on every point, so both new means are xΒ―. The point (xΒ―,xΒ―) is a stationary point of the likelihood. Along a=xΒ―+t,Β b=xΒ―βˆ’t the log-likelihood has second derivative βˆ‘k((xkβˆ’xΒ―)2βˆ’1), 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 ΞΎ 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. The M-step lowers KL to some value β‰₯βˆ’1Nlog⁑L(ΞΎβ€²)+c (by the chain rule), so log⁑L(ΞΎβ€²)β‰₯log⁑L(ΞΎ). 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)] and conclude that over q∈D the minimum of KL[q:p] is at q(h|x)=p(h|x).

Solution

Write q(x,h)=q(x)q(h|x) and the same for p; the logarithm of the ratio splits into a marginal part and a conditional part, and summing gives the identity. On D, qX=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) with w unknown too. Given posteriors rk, find the M-step update for w.

Solution

The expected complete-data log-likelihood contains βˆ‘k(rklog⁑w+(1βˆ’rk)log⁑(1βˆ’w)). Setting its derivative to zero gives wβ€²=1Nβˆ‘krk, 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), i=1,…,n, independent, with xi,yi∼N(ΞΌi,Οƒ2). The parameter of interest is Οƒ2; the means ΞΌ1,ΞΌ2,… are nuisance parameters, one new one for each pair.
The MLE is inconsistent. Maximizing over all ΞΌi gives ΞΌ^i=(xi+yi)/2 and
Οƒ^ML2=14nβˆ‘i(xiβˆ’yi)2Β βŸΆΒ Οƒ22.
More data never fixes it: each ΞΌ^i is always based on two observations.
Estimating function. A function y(x,Οƒ2) with EΟƒ2,ΞΌ[y]=0 for every value of the nuisance. The estimate solves βˆ‘iy(xi,Οƒ^2)=0, and it is consistent under mild conditions. Here y=12(xβˆ’y)2βˆ’Οƒ2 works, giving Οƒ~2=12nβˆ‘i(xiβˆ’yi)2.
Geometry. Over each value of Οƒ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 minus its projection onto the nuisance directions. Here xi+yi carries all the information about ΞΌi, and removing from the score its conditional expectation given xi+yi leaves a multiple of 12(xiβˆ’yi)2βˆ’Οƒ2.

Explore

Nuisance means ΞΌα΅’
Estimates of Οƒ2 (true value 1) as pairs arrive, log scale in n. MLE estimating function wrong model: one common mean
Each pair as a point (xi,yi). The nuisance moves points along the diagonal; Οƒ is the spread across it.

Worked example

Derive the MLE of Οƒ2 in the Neyman–Scott model and find its limit.

  1. Maximize the log-likelihood over ΞΌi with Οƒ2 fixed.

    β„“=βˆ’nlog⁑(2πσ2)βˆ’12Οƒ2βˆ‘i((xiβˆ’ΞΌi)2+(yiβˆ’ΞΌi)2). Each ΞΌi appears in one term, minimized at ΞΌ^i=(xi+yi)/2, where (xiβˆ’ΞΌ^i)2+(yiβˆ’ΞΌ^i)2=12(xiβˆ’yi)2.

  2. Now maximize over Οƒ2.

    The profile log-likelihood is βˆ’nlog⁑σ2βˆ’14Οƒ2βˆ‘(xiβˆ’yi)2+const. Setting the derivative to zero, Οƒ^2=14nβˆ‘(xiβˆ’yi)2.

  3. Find the limit as nβ†’βˆž.

    xiβˆ’yi∼N(0,2Οƒ2) whatever ΞΌi is, so E(xiβˆ’yi)2=2Οƒ2, and by the law of large numbers Οƒ^2β†’2Οƒ2/4=Οƒ2/2.

  4. Why did the usual consistency theorem fail?

    It assumes a fixed, finite number of parameters. Here the number of parameters, n+1, grows with the data, so the ΞΌ^i never settle down, and their errors bias Οƒ^2 by the same factor at every n. The estimating function 12(xβˆ’y)2βˆ’Οƒ2 avoids ΞΌi entirely.

Check your understanding

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

  1. Still to Οƒ2/2
  2. To Οƒ2, since there is no variation in the means to confuse itThe estimator only sees xiβˆ’yi, whose distribution does not depend on the ΞΌi at all.
  3. To 0E(xiβˆ’yi)2=2Οƒ2>0.
The bias comes from fitting n 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 is observed three times instead of twice. Where does the MLE of Οƒ2 converge?

  1. 23Οƒ2
  2. 13Οƒ2The MLE divides the within-group sum of squares by 3n; that sum has expectation (3βˆ’1)nΟƒ2.
  3. Οƒ2More observations per nuisance parameter reduce the bias but do not remove it.
With k observations per group, Οƒ^2=1knβˆ‘iβˆ‘j(xijβˆ’xΒ―i)2β†’kβˆ’1kΟƒ2. One degree of freedom per group is spent on estimating ΞΌi.

What makes y=12(xβˆ’y)2βˆ’Οƒ2 a valid estimating function?

  1. Its expectation is zero for every value of the nuisance ΞΌi
  2. It is the score function for Οƒ2The score is βˆ’1Οƒ2+(xβˆ’ΞΌ)2+(yβˆ’ΞΌ)22Οƒ4, which involves the unknown ΞΌ.
  3. Its expectation is zero when ΞΌi=0That would not be enough: we need unbiasedness whatever the ΞΌi are, since we never learn them.
xβˆ’y∼N(0,2Οƒ2) for every ΞΌ, so E[12(xβˆ’y)2]=Οƒ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βˆ’yi for four pairs are 0.4,Β βˆ’1.0,Β 1.6,Β 0.2. Compute Οƒ^ML2 and Οƒ~2.

Solution

βˆ‘di2=0.16+1+2.56+0.04=3.76. So Οƒ^ML2=3.76/16=0.235 and Οƒ~2=3.76/8=0.47, always in the ratio 1 : 2.

Conditioning away the nuisanceA likelihood that works

Show that di=xiβˆ’yi and si=xi+yi are independent, that the distribution of di does not involve ΞΌi, and that maximizing the likelihood of the di alone gives Οƒ~2.

Solution

(di,si) is a linear image of a Gaussian vector with Cov(di,si)=Οƒ2βˆ’Οƒ2=0, so they are jointly Gaussian and uncorrelated, hence independent. di∼N(0,2Οƒ2). The MLE of the variance 2Οƒ2 from the di is 1nβˆ‘di2, so Οƒ2 is estimated by 12nβˆ‘di2=Οƒ~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,…,xm and any Bregman divergence,
βˆ‘kDψ[xk:c]=βˆ‘kDψ[xk:xΒ―]+mDψ[xΒ―:c],
so arg⁑mincβˆ‘kDψ[xk:c]=xΒ―, the arithmetic mean, whatever ψ is.
The other side. arg⁑mincβˆ‘kDψ[c:xk] is the mean taken in the dual coordinates, βˆ‡Οˆβˆ—(1mβˆ‘kβˆ‡Οˆ(xk)). For the generalized KL divergence that is the geometric mean, for Itakura–Saito the harmonic mean.
Straight boundaries. Dψ[x:c1]βˆ’Dψ[x:c2] is an affine function of x: the ψ(x) terms cancel. So the cells {x:Dψ[x:cj]Β smallest} are convex polygons.
Bregman k-means. Alternate: assign each point to the centre with the smallest Dψ[x:cj]; move each centre to the mean of its points. Each step lowers βˆ‘kDψ[xk:cj(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; generalized KL xlog⁑xcβˆ’x+c; Itakura–Saito xcβˆ’log⁑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Β―). The last sum is 0 and βˆ‘k(xkβˆ’c)=m(xΒ―βˆ’c), leaving m(ψ(xΒ―)βˆ’Οˆ(c)βˆ’βˆ‡Οˆ(c)β‹…(xΒ―βˆ’c))=mD[xΒ―:c].

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

    All three are 2.5, the arithmetic mean.

  3. What are the "centre first" centroids?

    Squared distance: βˆ‡Οˆ(x)=x, so again 2.5. Generalized KL, ψ=xlog⁑xβˆ’x: βˆ‡Οˆ=log⁑x, so the centroid is exp⁑(log⁑1+log⁑42)=2. Itakura–Saito, ψ=βˆ’log⁑x: βˆ‡Οˆ=βˆ’1/x, so the centroid is 1/(1+1/42)=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/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), which c minimizes βˆ‘kD[xk:c]?

  1. The arithmetic mean of the xk
  2. The geometric meanThat minimizes βˆ‘kD[c:xk], 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, so cj=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]: the log⁑xj terms cancel and what is left is affine in x.
  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⁑c1jc2j, affine in x. 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)]?

  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)).

Hint

Module 1: Dψ[c:x]=DΟˆβˆ—[βˆ‡Οˆ(x):βˆ‡Οˆ(c)].

Solution

In dual coordinates the problem is minβˆ‘kDΟˆβˆ—[yk:Ξ³] with yk=βˆ‡Οˆ(xk), Ξ³=βˆ‡Οˆ(c). By the centroid identity for Οˆβˆ— the minimizer is Ξ³=yΒ―, so c=βˆ‡Οˆβˆ—(yΒ―).

The KL boundaryAn explicit line

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

Solution

D[x:c1]βˆ’D[x:c2]=βˆ‘jxjlog⁑c2jc1j+βˆ‘j(c1jβˆ’c2j)=x1log⁑2βˆ’1. The boundary is the vertical line x1=1/log⁑2β‰ˆ1.443, not the bisector x1=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ΞΎ) subject to 12dΞΎTG(ΞΎ)dΞΎ=Ξ΅2 gives dΞΎβˆβˆ’Gβˆ’1βˆ‡L. The natural gradient is βˆ‡~L=Gβˆ’1βˆ‡L, and learning is ΞΎt+1=ΞΎtβˆ’Ξ·Gβˆ’1(ΞΎt)βˆ‡L(ΞΎt).
Invariance. Under a change of coordinates both βˆ‡L and G transform, and Gβˆ’1βˆ‡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 Ξ·.
Efficiency. In online learning from one example at a time, natural gradient with step Ξ·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βˆ’1, escapes them much faster.

Below, a normal model N(ΞΌ,Οƒ2) is fitted to the target N(1,0.42) by minimizing L=KL[target:model]=log⁑σ0.4+0.42+(ΞΌβˆ’1)22Οƒ2βˆ’12. With G=diag(1/Οƒ2,2/Οƒ2) the natural gradient step is Δμ=βˆ’Ξ·(ΞΌβˆ’1), Δσ=βˆ’Ξ·2(Οƒβˆ’0.42+(ΞΌβˆ’1)2Οƒ).

Explore

Plain gradient descent in coordinates
natural gradient plain gradient. Contours of L. Drag the start point; the target is the ring.
log10⁑L against iteration (first 150).

Worked example

Fit a Bernoulli model in its natural parameter ΞΈ (the log-odds) to data with frequency p^=0.8, by minimizing the average negative log-likelihood L(ΞΈ)=ψ(ΞΈ)βˆ’ΞΈp^, ψ=log⁑(1+eΞΈ). Start at ΞΈ=0 and use step size 1.

  1. Compute βˆ‡L and the Fisher information G.

    Lβ€²(ΞΈ)=Οˆβ€²(ΞΈ)βˆ’p^=pβˆ’p^ with p=1/(1+eβˆ’ΞΈ), and G=Οˆβ€³(ΞΈ)=p(1βˆ’p).

  2. Take one plain and one natural gradient step from ΞΈ=0.

    At ΞΈ=0: p=0.5, Lβ€²=βˆ’0.3, G=0.25. Plain: ΞΈ=0.3, so p=0.574. Natural: ΞΈ=0+0.3/0.25=1.2, so p=0.769.

  3. Take a second natural gradient step. How close is it to the answer ΞΈβˆ—=log⁑4β‰ˆ1.386?

    At ΞΈ=1.2: p=0.7685, Lβ€²=βˆ’0.0315, G=0.1779, so ΞΈ=1.2+0.177=1.377, with p=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(ΞΈ): the Fisher information is the Hessian of the loss. So the natural gradient step with Ξ·=1 is exactly Newton's method here.

Check your understanding

From the same start, with a very small step, plain gradient descent on L(ΞΌ,Οƒ) and on L(ΞΌ,log⁑σ) 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/βˆ‚Οƒ, and a step in log⁑σ moves Οƒ by Οƒ times as much again. The Οƒ-velocity is multiplied by Οƒ2.
  3. the same path, but at different speedsOnly the Οƒ 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 (ΞΌ,Οƒ) need tiny steps when Οƒ is small?

  1. The loss curvature in ΞΌ is about 1/Οƒ2, so a stable step must be of order Οƒ2
  2. The loss is not differentiable at small ΟƒIt is smooth for every Οƒ>0.
  3. The gradient vanishes thereThe opposite: it is huge, like 1/Οƒ2 and 1/Οƒ3.
Gradient descent on a quadratic with curvature k is stable only for Ξ·<2/k. The natural gradient multiplies by Gβˆ’1, which contains the factor Οƒ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) with Οƒ known and loss L(ΞΌ)=12Οƒ2β‹…1Nβˆ‘k(xkβˆ’ΞΌ)2, compute the plain and natural gradient steps in ΞΌ.

Solution

Lβ€²(ΞΌ)=(ΞΌβˆ’xΒ―)/Οƒ2 and G=1/Οƒ2. Plain: Δμ=βˆ’Ξ·(ΞΌβˆ’xΒ―)/Οƒ2, whose behaviour depends on Οƒ. Natural: Δμ=βˆ’Ξ·(ΞΌβˆ’xΒ―), the same for every Οƒ; with Ξ·=1 it jumps to xΒ― at once.

Why it is invariantThe transformation rule

Let ΞΎ=f(ΞΆ) with Jacobian J=βˆ‚ΞΎ/βˆ‚ΞΆ. Show that JGΞΆβˆ’1βˆ‡ΞΆL=GΞΎβˆ’1βˆ‡ΞΎL: the two natural gradients are the same tangent vector.

Solution

βˆ‡ΞΆL=JTβˆ‡ΞΎL and GΞΆ=JTGΞΎJ. So GΞΆβˆ’1βˆ‡ΞΆL=Jβˆ’1GΞΎβˆ’1Jβˆ’TJTβˆ‡ΞΎL=Jβˆ’1GΞΎβˆ’1βˆ‡ΞΎL; multiply by J. The plain gradient βˆ‡ΞΆL instead becomes JJTβˆ‡ΞΎL in ΞΎ-coordinates, which depends on f.

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=As, where s has independent, non-Gaussian components and A is invertible and unknown. We look for W such that y=Wx has independent components. At best this recovers s up to the order and scale of its components.
The loss. Choose model densities qi for the sources. The negative log-likelihood per sample is L(W)=βˆ’log⁑|detW|βˆ’βˆ‘iElog⁑qi(yi), with gradient βˆ‡L=βˆ’Wβˆ’T+E[Ο†(y)xT], where Ο†i=βˆ’(log⁑qi)β€².
Natural gradient on the matrix group. Use a metric on invertible matrices that is invariant under W↦WB (it measures dW through dWWβˆ’1). The natural gradient step is
Ξ”W=Ξ·(Iβˆ’E[Ο†(y)yT])W,
which also needs no matrix inverse.
Equivariance. Write C=WA, so that y=Cs. The natural gradient gives Ξ”C=Ξ·(Iβˆ’E[Ο†(Cs)(Cs)T])C: A has disappeared. The plain gradient gives Ξ”C=Ξ·(Cβˆ’Tβˆ’E[Ο†(y)sT])ATA, which depends on A through ATA.

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 is a suitable choice), batch updates with Ξ·=0.05, and both runs start from the same global matrix C0=W0A.

Explore

Mixing matrix A
Scatter shows
The mixtures x=As. Independent uniform sources would fill an axis-aligned square.
Separation error of C=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 βˆ‡LWTW. So Ξ”W=βˆ’Ξ·(βˆ’Wβˆ’T+E[Ο†(y)xT])WTW=Ξ·(Iβˆ’E[Ο†(y)yT])W, using xTWT=yT.

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

    Ξ”C=Ξ”WA=Ξ·(Iβˆ’E[Ο†(y)yT])C, and y=Cs. Everything is in terms of C and s: the trajectory of C depends only on where it starts.

  3. Where does it stop? Take y=Ds with D diagonal and si uniform with unit variance.

    Off the diagonal, E[yi3yj]=E[yi3]E[yj]=0 by independence. On the diagonal we need E[yi4]=1: di4E[si4]=1. For uniform s on [βˆ’3,3], Es4=9/5, so di=(5/9)1/4β‰ˆ0.863. Look at the diagonal of C in the explorer after a run (the sample of 400 moves it slightly).

  4. And the plain gradient?

    Ξ”C=Ξ·(Cβˆ’Tβˆ’E[Ο†(y)sT])ATA. Same fixed points, but the step is preconditioned by ATA. A badly conditioned A 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) for any permutation P and diagonal Ξ›: 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Οƒ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=WA…

  1. depends only on its starting value and the sources, not on A
  2. depends on A only through its condition numberThat describes the plain gradient, whose dynamics carry the factor ATA.
  3. does not depend on the sourcesThe update averages Ο†(y)yT over y=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 C0, the only difference between the settings is A itself.

Practice

The gradient of the log-determinantWhere W^(βˆ’T) comes from

Show that βˆ‚log⁑|detW|/βˆ‚Wij=(Wβˆ’T)ij, and hence derive βˆ‡L above.

Solution

dlog⁑|detW|=tr(Wβˆ’1dW)=βˆ‘ij(Wβˆ’1)jidWij, so the gradient is (Wβˆ’1)T. For the other term, βˆ‚(βˆ’log⁑qi(yi))/βˆ‚Wij=Ο†i(yi)xj, which gives E[Ο†(y)xT].

Super-Gaussian sourcesChoosing the nonlinearity

For Laplace sources, density ∝eβˆ’2|s| (unit variance), what is the score Ο†=βˆ’(log⁑q)β€² if q is the true density? Why do practical algorithms use tanh instead?

Solution

βˆ’log⁑q=2|s|+const, so Ο†(s)=2sign(s). It is discontinuous at 0, which makes the update rough; tanh⁑(Ξ²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 y3 is the usual choice.)