Is KL divergence a distance, and why is minimising cross-entropy the same as maximum likelihood?

Probability and statistics, Information theory
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you precisely understand the information-theoretic losses used throughout classification.

Key idea

The KL divergence satisfies DKL(p ∥ q)=H(p,q)−H(p)≥0, where H(p,q) is the cross-entropy and H(p) is the entropy of p. But it is not symmetric and fails the triangle inequality, so it is not a metric. With p fixed (the data), minimising H(p,q) over the model q is the same as minimising KL, which is the same as maximising the average log-likelihood.

Steps

  1. Define DKL(p∥q)=∑xp(x)log⁡p(x)q(x). Show it is non-negative with Jensen’s inequality; this result is called Gibbs’ inequality.
  2. Give a two-point example showing DKL(p∥q)≠DKL(q∥p): for p=(0.5,0.5) and q=(0.9,0.1), DKL(p∥q)=0.5ln⁡(0.5/0.9)+0.5ln⁡(0.5/0.1)≈0.511 nats, whereas DKL(q∥p)=0.9ln⁡(0.9/0.5)+0.1ln⁡(0.1/0.5)≈0.368 nats.
  3. Decompose H(p,q)=H(p)+DKL(p∥q). Since H(p) does not depend on the model, minimising one is the same as minimising the other.
  4. Take p to be the empirical distribution p^, which puts mass 1/n on each of the n training points xi. Then H(p^,qθ)=−1n∑ilog⁡qθ(xi), the negative average log-likelihood.
  5. Mention how forward and reverse KL typically behave when q is too simple to match p, for example one Gaussian fitted to a two-peaked p. Minimising forward KL DKL(p∥q) tends to be mass-covering: q must put mass wherever p does, or the divergence blows up. Minimising reverse KL DKL(q∥p) tends to be mode-seeking: q is penalised for mass where p is small, so it often locks onto one peak. These are tendencies, not theorems.

Common mistakes

How long your answer should be

About 3 minutes; one equation per claim.

Read this

Previous in Probability and statistics: What is the difference between MLE and MAP estimation, and how can you show that L2-regularised linear regression is MAP with a Gaussian prior?
Next in Probability and statistics: What are the maximum likelihood estimates of μ and σ2 from independent samples x1,…,xn of N(μ,σ2), and how do you derive them?