KL Divergence and Coding Mismatch

Compute the excess expected log loss of a wrong model and identify why support and direction matter.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. The logarithmic ratio compares two descriptions
  2. The sign and direction have different meanings

The logarithmic ratio compares two descriptions

For discrete distributions, \(D(P\|Q)=\sum_i p_i\log(p_i/q_i)\). If \(Q\) assigns zero probability to an outcome with positive \(P\) probability, the divergence is infinite. When it is finite, it is the expected log-loss difference between announcing \(Q\) and announcing \(P\) on outcomes from \(P\), with units determined by the logarithm base.

The sign and direction have different meanings

Nonnegativity follows from convexity of minus log applied to \(q_i/p_i\) under \(P\). The expression need not equal \(D(Q\|P)\) because a different distribution determines which errors receive weight. Thus it is a useful discrepancy without being a metric. Cross-entropy measures the total coding cost. Proper log scoring explains why expectation encourages the forecast to match its true distribution.[1][2]

References

  1. Claude E. Shannon, A Mathematical Theory of Communication ↩
  2. David J. C. MacKay, Information Theory, Inference, and Learning Algorithms ↩