The Kullback Leibler distance (KL-distance) is a natural distance function from a "true" probability distribution, p, to a "target" probability distribution, q. It can be interpreted as the expected extra message-length per datum due to using a code based on the wrong (target) distribution compared to using a code based on the true distribution.
For discrete (not necessarily finite) probability distributions, p={p
1, ..., p
n} and q={q
1, ..., q
n}, the KL-distance is defined to be
KL(p, q) =
Σi p
i . log
2(
pi /
qi )
For continuous probability densities, the sum is replaced by an integral.
KL(p, p) = 0
KL(p, q) ≥ 0
Note that the KL-distance is not, in general, symmetric.