Definitioncore
Kullback-Leibler divergence
Also called KL divergence, relative entropy, information divergence.
The expected log ratio of two densities under the first one. It is never negative, is zero only for equal laws, is not symmetric, and the MLE minimizes its empirical version.
The Kullback-Leibler divergence measures how much a probability law differs from a law , seen from the side of . It is the expected log likelihood ratio of to when the data come from . It is zero only when the two laws are equal and is positive otherwise, but it is not symmetric and it does not obey the triangle inequality, so it is not a distance. In statistics it is the target that maximum likelihood estimates: the MLE minimizes an empirical version of over the model, and its local curvature is the Fisher information.
Definition
Let and be probability laws on the same space.
Discrete case. If and have probability mass functions and on a countable set,
with the conventions for every and for .
Densities. If and have densities and with respect to a common measure (Lebesgue measure, counting measure, or ),
General case. If is absolutely continuous with respect to (every event with also has ), then , where is the Radon-Nikodym derivative. Otherwise .
The value lies in . With the natural log the unit is the nat; with it is the bit. For a parametric family we write for .
Properties
Gibbs inequality. , with equality if and only if .
Proof. It suffices to treat the case where is finite, so wherever . Let . For , , with equality only at . Put for :
Equality in the first step needs almost everywhere on , and equality in the second needs . Together they give almost everywhere, so .
The integral in the first line is well defined, because its integrand is bounded above by the integrable function .
Not symmetric. In general ; one can be finite while the other is infinite. The symmetric sum is what Kullback and Leibler called the divergence in 1951; today "KL divergence" means the one-sided quantity.
Additive over independent coordinates. If and , then , because the log of a product is a sum. For iid observations, .
Local form. If the family satisfies the regularity conditions of Fisher information (enough smoothness to differentiate twice under the integral sign), then
where is the Fisher information of one observation. The first-order term vanishes because the score has mean zero, and the second-order term is the mean of minus the Hessian of .
Pinsker's inequality. The total variation distance satisfies , with in nats (Cover and Thomas, Section 11.6). So a small divergence forces the two laws to give nearly equal probabilities to every event.
Entropy and cross entropy. For discrete laws, , where is the Shannon entropy and is the cross entropy. Minimizing cross-entropy loss over with fixed is the same as minimizing .
Maximum likelihood minimizes an empirical divergence. Let be iid from a law with density , and let be a model that may not contain . Then
The first term does not depend on , so minimizing is the same as maximizing , and the MLE maximizes the sample mean of that expectation. Under regularity conditions the MLE converges almost surely to the minimizer of (White 1982). When the model is correct, by the Gibbs inequality, which is the core of consistency proofs for the MLE.
Examples and non-examples
Two Bernoulli laws. nats, while nats. The two directions differ.
An exact asymmetric example in bits. On four points let and . Every ratio is a power of 2, so the logs in base 2 are integers and the sums are exact rationals:
One direction infinite. Let and . Then bit, but , because puts mass on a point where is zero. A model that gives probability zero to an event that can happen is infinitely far from the truth in this direction.
Normal laws. For and ,
With equal variances this is , which is exactly with and . The local form is exact here.
Local form for a Bernoulli law. For the Fisher information is . At , nats against ; at the values are 0.00023517 and 0.00023810.
Pinsker's inequality. For and , nats and the total variation distance is 0.25, below the bound .
A misspecified model. Let the data come from a Gamma law with shape 2 and rate 1 (mean 2), and fit the exponential model . Then , which is largest at . The exponential MLE converges almost surely to , the rate of the exponential law closest to the Gamma law in Kullback-Leibler divergence.
Non-example: not a metric. The divergence is not symmetric (see above), and it does not satisfy the triangle inequality. For Bernoulli laws with success probabilities , and , , but nats.
Non-example: a difference of entropies. is not . Two laws with the same entropy, such as and a permutation of , have equal entropies but positive divergence when the permutation moves mass.
Related definitions
- Shannon entropy: ; the divergence from to the uniform law on points is .
- Cross-entropy loss: .
- Bregman divergence: the KL divergence between members of an exponential family is a Bregman divergence of the log-partition function.
- Total variation distance: bounded by the square root of half the divergence (Pinsker).
- Fisher information: the Hessian of at .
- Evidence lower bound and variational inference: fit an approximation by minimizing , the reverse direction.
- Akaike information criterion: an estimate of the expected divergence of a fitted model, up to a constant.
- Asymptotic normality of the MLE: uses the Gibbs inequality for identifiability and consistency.
References
- S. Kullback and R. A. Leibler, On information and sufficiency, Annals of Mathematical Statistics 22(1), 1951, pages 79 to 86 (definition of the mean information for discrimination and the divergence, and their properties)
- Thomas M. Cover and Joy A. Thomas, Elements of Information Theory, second edition, Wiley, 2006, Chapter 2, Section 2.3 (relative entropy), Section 2.5 (chain rule) and Theorem 2.6.3 (information inequality); Chapter 11, Section 11.6 (Pinsker's inequality)
- H. White, Maximum likelihood estimation of misspecified models, Econometrica 50(1), 1982, pages 1 to 25 (the quasi-maximum likelihood estimator converges to the minimizer of the Kullback-Leibler divergence)
Where this leads
- Advanced composition theorem
- Akaike information criterion
- ARACNE
- Asymptotic normality of the MLE
- Constant composition distribution matching
- Direct preference optimization
- Entropy-based n-gram pruning
- KLD-sampling
- Maximum entropy method for image reconstruction
- Motif information content
- Multiplicative weights exponential mechanism
- Nested sampling
- Reference prior
- Reinforcement learning from human feedback
- Renyi differential privacy
- Widely applicable information criterion
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 51K26E Edit this page History Report an error Markdown