LESSON 2.22 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Entropy, cross-entropy and KL divergence
Send 16 weather reports in bits, and count the bits a wrong code wastes.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 2.22 · ENTROPY BAYSUN 1 BIT · CLOUD 2 · RAIN 3 · SNOW 3
01
Stage 1 of 6 · Surprisal
Rare outcomes carry more surprisal: log₂ 1/p bits. Sun (1/2) needs 1, snow (1/8) needs 3.
Explain it simply
Each teal bar is the chance of one kind of weather. The cells under it are its code word, one bit per yes-or-no question. Sun comes half the time, so one question finds it. Each time the chance halves, it takes one more bit, so snow, at 1 in 8, takes 3 bits.
Four outcomes with chances 1/2, 1/4, 1/8, 1/8. Their code words under p: sun 1 bits, cloud 2 bits, rain 3 bits, snow 3 bits.
source p, its codemodel q, its codeextra bits, lossa symbol
Toy: one weather source · 4 outcomes · chances in eighths · a Huffman code per distribution · 16 symbols
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each halving of the chance adds one bit.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.