Path
Probability & information · Lesson 6
Information and entropy
Information measures surprise. Entropy is expected surprise under a distribution. Cross-entropy ties probability to the losses classifiers use.
Core ~25 minDeep study ~75 minWhat is a bit of information?Why does cross-entropy work as a loss?
Before this: Expectation and loss, Correlation, sampling, and calibration
How this idea was born
Communication through noise forces a hard question: how much surprise does a message carry, and how many bits do you need to send it reliably? Compression, phone lines, and codes all trade in uncertainty that can be measured, not only felt.
Claude Shannon's 1948 paper founded information theory: bits, entropy, and communication through noise. MacTutor and the primary paper (linked in further reading) are the stops. Steal the ethic: playful rigor. Treat "information" as something you can define and measure, then build systems that respect the math. Entropy is expected surprisal. Cross-entropy ties that instinct to the losses classifiers use every day.
For a modern rereader, chance gave you weights and expectation gave you averages; this chapter asks how surprised you should be, then averages that surprise. Language models live here.
First principles
If an event has probability , its surprisal (self-information) is
(in bits). Rarer events surprise more.
Entropy of a discrete distribution is expected surprisal:
A sure outcome has entropy 0. A fair coin has entropy 1 bit.
If true labels follow and a model predicts ,
is cross-entropy. When is a one-hot label, this becomes : the usual classifier loss.
KL divergence (preview): measures extra surprise from using instead of .
Worked intuition
If a fair coin flip landing heads barely surprises you, a fair die landing on a predicted face surprises you more (probability versus ). Shannon turned that graded surprise into bits. Entropy averages it. Cross-entropy asks how surprised a model should be by the truth.
English text has lower entropy than random letters: compression exploits that structure. Shannon made the intuition quantitative. Noisy channels need codes that respect entropy limits; that is communication theory's heart.
Algebrica may not center Shannon entropy on one page, but its discrete random variables treatment is the right substrate. Shannon's 1948 paper (in further reading) is worth skimming for definitions alone.
Cross-entropy is merciless toward confident wrongness: if is tiny, is huge. That pain is the training signal.
Common confusions
Information as "meaning." Shannon information is about surprise and coding length under a distribution, not about semantic importance. A rare nonsense string can carry many bits.
Entropy as "disorder" without a distribution. Entropy is a functional of a probability distribution. Metaphorical disorder talk is optional and often sloppy.
Cross-entropy versus accuracy. Accuracy counts winners. Cross-entropy scores probabilistic honesty. A model can be accurate yet poorly calibrated, or the reverse on hard sets.
KL as a symmetric distance. is not generally equal to , and it is not a metric. It is a directed extra-surprisal score.
Calling any large file "high entropy" without a model. Entropy needs a distribution. A large deterministic file can compress to almost nothing.
Equating mutual information with causation. Dependence is not cause. Information measures statistical connection, not mechanism.
History & stories
Claude Shannon's 1948 paper founded information theory: bits, entropy, and communication through noise. MacTutor's Shannon biography and accessible portraits (such as Veritasium's The Bit Player material linked in further reading) convey the playful rigor. He played as hard as he thought, building gadgets and juggling ideas.
Treat information as measurable, then build systems that respect the math. That ethic is why compression, coding, and modern probabilistic ML share a vocabulary.
Real world
Compression, noisy phone lines, and efficient codes all trade in entropy: how much uncertainty a source has, and how many bits you need. File formats, error-correcting codes, and streaming protocols are engineering descendants of the same ideas.
Whenever a system says "this message was unexpected," Shannon offers a meter.
Open when you want the machine-learning connection. Skip freely.
Field notes, extra examples, and glossary live here when you want more than the core path.
Carry this forward
- Information is surprisal; entropy is expected surprisal; cross-entropy scores models against truth.
- KL measures extra surprise from a mismatched distribution.
- Probability track checkpoint: chance, updating, expectation, information. You now have the math spine for much of modern ML.
Read more
Go deeper when curiosity hits - videos, essays, and primary trails.
- referenceMacTutor - Claude Shannon
- video3Blue1Brown / other - but prefer: Veritasium - The Bit Player / ShannonAccessible portrait of Shannon and information.
- referenceShannon 1948 paper (historical primary)Skim for definitions of entropy; no need to master proofs now.
- articleAlgebrica - Discrete random variablesDistribution language that entropy builds on; Algebrica diagrams help.
- bookSteven Strogatz - The Joy of XInformation as measurable surprise.
Check your understanding
A short learning loop - try a few, learn from misses, mark complete when you have engaged. No timer, no scoreboard.
Try at least 3 core prompts, or choose I'll return later.