Idea: Bits per message
A feed sends updates, trades, cancels and halts with chances , , , .
- A fixed code needs bits for each
- Code words , , , : short for common
- No word starts another, so no separators are needed
Example: The average code length
With code words , , , for chances , , , , what is the average length in bits?
- Lengths , , ,
- bits
Formula: Entropy
The average surprise −log₂ p, in bits: the floor for any lossless code.
Idea: Surprise
Each code length above is : chance took bits.
- Rare outcomes surprise more
- A certain outcome carries no surprise
- counts good yes or no questions on average
Formula: Independent sources add
Chances of independent events multiply, and logs turn products into sums.
Idea: Both ends of the scale
On values, for every distribution.
- when one value is certain
- when all are equally likely
- equal sectors: bits
Quick check: Kind and venue
Each message also comes from venue A, B or C with chances , , , independent of its kind. What is the entropy of the pair?
Show the answer
Answer:
Venue bits plus kind bits: .
Common mistake: Entropy is not variance
Payoffs , , and , , with the same chances have the same entropy.
Instead asks which outcome comes; variance asks how far apart the outcomes lie.
Idea: Say it in an interview
Entropy is the average bits an optimal code needs: uncertainty about the outcome.
- Show it on chances that are powers of
- Then every logarithm is a whole number