Information Theory
Information theory measures uncertainty, surprise, compression, and dependence. In machine learning it appears whenever probabilities become objectives: cross-entropy losses, KL divergence regularizers, mutual-information criteria, calibration, and generative-model likelihoods.
Defining math
For a discrete outcome with probability , its self-information or surprisal is
The expected surprisal is entropy:
From entropy come the main derived quantities:
and mutual information, . The log base sets units: base 2 gives bits; natural log gives nats.
Worked example
For a source with probabilities , the most likely event carries bit of surprisal. Each less likely event carries bits because it takes one more yes/no distinction to isolate an outcome that happens only one quarter of the time.
The expected code length is the probability-weighted average, bits. That is the entropy: common events cost fewer bits when they occur, rare events cost more, and the average measures the source’s uncertainty before observing the event.
Caveats
Information quantities depend on the probability model. Empirical estimates can be biased with sparse samples, and continuous variables require densities or discretization choices rather than the simple finite-sum formulas above.
References
- MacKay, Information Theory, Inference, and Learning Algorithms
- SciPy documentation:
scipy.special.rel_entr
Nav