Entropy
Finite entropy is the probability-weighted average of each outcome’s surprisal.
On this page 8 sections
01Entropy is the average surprise of outcomes drawn from a distribution#
Entropy is the average surprise of outcomes drawn from a distribution. It summarizes uncertainty before an outcome is observed. A distribution concentrated on one certain outcome has no uncertainty; a spread across several plausible outcomes can have more.
Entropy is the expected surprisal of a finite distribution. Find each outcome’s surprisal, then average using its own probability.
For masses 0.5,0.125,0.125,0.125,0.125, the first contribution is 0.5 bits. Each small outcome adds 0.375 bits, giving entropy 2 bits.
For probabilities , the surprises are bits. Weight each by how often that outcome occurs: bits. Averaging the three surprises equally would incorrectly treat the categories as equally likely.
PMF masses: . Find entropy in bits.
Show answer and explanation
Positive-mass contributions: 0.5, 0.375, 0.375, 0.5 bits. Sum: bits. Zero masses contribute 0.
02Category counts define an empirical distribution after you divide by their total#
Category counts define an empirical distribution after you divide by their total. Use those probabilities as weights, rather than assuming the categories are equally likely.
Entropy does not change when you rename the categories. It depends on how the probability is distributed.
Category counts: . Use their empirical PMF. Find entropy in bits.
Show answer and explanation
Normalize the counts. Positive-mass contributions: 0.5, 0.5, 0.5 bits. Sum: bits. Zero masses contribute 0.
03A zero-probability outcome contributes 0 by the convention 0log 0=0#
A zero-probability outcome contributes 0 by the convention . A distribution concentrated on one outcome has entropy 0.
Zero entropy means certainty under that distribution. A forecaster can be certain and wrong, so entropy alone cannot establish factual correctness.
PMF masses: . A draft treats a zero mass as an infinite entropy term. Correct the entropy in bits.
Show answer and explanation
Contributions: 0.5+0.5+0.5+0=1.5 bits.
04A closer look#
Entropy supplies a baseline expected log loss when a forecast matches the target distribution. It describes the stated distribution, not how confident a learner feels. A zero-probability category contributes zero to the expectation; it is never drawn from that distribution.
Weight each surprisal by its probability, treat zero-mass terms as zero, and interpret the result as uncertainty.
- Compute entropy of a finite probability distribution.
Sources & further reading
- [1]Cosma Shalizi: Information Theory I, entropy and zero-mass conventions ↗Cosma Shalizi · Article
- [2]Dive into Deep Learning §22.11 ↗Dive into Deep Learning §22.11 · Article