Repository navigation
0.7. Information Theory (Shannon)
Information is resolved uncertainty.
Information theory begins when probability starts asking what is learned when something happens.
Learning, to Shannon, is reducing your space of uncertainty. Reducing your ignorance. It rings similar to Conan Doyle's "When you discard all other possibilities, truth remains."
Data is an observation. Information is what that observation changes about possibility.
A Datum by itself carries no absolute quantity of information.
Necesitamos una distribución
Cuanto menos esperábamos un resultado, más aprendemos al observarlo:
Si ya sabíamos qué iba a ocurrir, observarlo no resuelve incertidumbre.
Si dos observaciones independientes tienen probabilidades
La base no cambia la estructura; cambia la unidad. Base 2 → bits
Para
Para
Antes de observar
Si hay
Una distribución determinista tiene
Ésta es la puerta hacia lenguaje, inferencia, Bayes, cross-entropy y mutual information.
Probability of the exact observation
Probability of a class/event we consider remarkable
Evidence that perhaps our assumed model was wrong
The central conceptual chain should be:
Reality
│
▼
Outcome
ω ∈ Ω
│
│ observation / measurement
▼
X : Ω → 𝒳
│
▼
Observed value
x ∈ 𝒳
│
▼
Probability
pX(x)
│
▼
Surprisal
I(x) = -log₂ pX(x)
│
│ expectation
▼
Entropy
H(X) = E[I(X)]
The important transition is:
possibility → observation → probability → information
Probability describes the structure before an outcome is known.
Information describes what is resolved when an observation arrives.
This distinction should become part of the theoretical vocabulary of the project.
Ω describes the possible states or outcomes admitted by the model.
An element is:
ω ∈ Ω
The outcome is not necessarily the datum we eventually record.
𝒳 is the set of values an observable can produce.
Examples:
𝒳 = {Head, Tail}
𝒳 = {⚀, ⚁, ⚂, ⚃, ⚄, ⚅}
𝒳 = ℝ
𝒳 = {positive, negative}
𝒳 = vocabulary of a language
This connects directly with the existing idea:
Types are alphabets.
A random variable is the bridge:
It transforms an underlying outcome into a value that can be observed, recorded, compared, transmitted, or analyzed.
This is a fundamental connection with the philosophy of Data:
Data is not the world itself.
Data is what an observation preserves about the world.
A single reality may admit many different observables.
ω
├── X₁(ω) = temperature
├── X₂(ω) = color
├── X₃(ω) = category
└── X₄(ω) = signal amplitude
Different measurements produce different data because they preserve different distinctions.
Suppose:
Before observing X, we have a distribution over its possible values.
For an outcome x:
describes how expected that observation was under the model.
This gives the first bridge between probability and information:
Rare observations resolve more uncertainty than common observations.
Symbolically:
The information carried by observing an outcome x is:
This quantity is often called:
- surprisal
- self-information
- information content
For the book, surprise or surprisal is probably the best conceptual entry point.
Information is logarithmic rarity.
A probable event teaches us little.
If:
then:
The observation tells us nothing we did not already know.
At the opposite extreme:
implies:
A sufficiently unexpected observation carries large information relative to the model.
⚜️ This relativity matters:
Information is not an intrinsic property of a symbol.
The same observation can carry different amounts of information under different models.
The logarithm should not appear as an arbitrary definition.
The crucial property is additivity.
Suppose two independent observations occur:
We want their combined information to satisfy:
Therefore:
The logarithm transforms multiplication into addition:
Hence:
up to a multiplicative constant / choice of unit.
⚜️ Focus on this idea:
Independent probabilities multiply.
Independent information adds.
This is one of the conceptual reasons information theory is logarithmic.
Using logarithm base 2 gives information in bits.
Examples:
A useful interpretation is:
One bit corresponds to resolving one fair binary distinction.
Equivalently, each bit halves the remaining possibilities under an ideal binary partition.
This distinction should be explicit very early.
Surprisal belongs to a particular observation:
It is evaluated after a specific value occurs.
Entropy belongs to a distribution:
For a discrete random variable:
So:
I(x) → information in this observation
H(X) → expected information before observing X
⚜️ The first introductory chapter should probably stop here.
Conditional entropy, mutual information, KL divergence, coding theorems, etc. can come later.
Substituting surprisal into the expectation:
gives:
This interpretation is preferable to presenting entropy initially as an unexplained formula.
Entropy is the average surprise produced by a source.
Or, more cautiously:
Entropy measures the expected information obtained when the uncertainty represented by a distribution is resolved.
If one outcome has probability 1:
p = [1, 0, 0, ...]
then:
Nothing remains to be learned.
For N equally probable outcomes:
then:
The uniform distribution maximizes entropy among distributions over the same finite alphabet.
Interpretation:
Uncertainty is maximal when no available outcome is preferred over another.
A useful opening example is ten consecutive heads:
HHHHHHHHHH
For a fair coin:
Therefore:
But the sequence:
HTHHTTHTTH
also satisfies:
Every exact sequence of ten fair coin tosses has the same probability.
So Shannon surprisal alone does not explain why:
HHHHHHHHHH
looks more remarkable.
This distinction is worth emphasizing rather than hiding.
What humans casually call "surprising" may refer to several different mathematical ideas.
1. Outcome surprise
↓
How improbable was this exact observation?
2. Pattern surprise
↓
How improbable is the class or structure we noticed?
3. Model surprise
↓
Does this observation make another model more plausible?
The first belongs directly to Shannon information.
The other two lead toward deeper theories.
HHHHHHHHHH has a visible structure.
Humans rarely ask only:
What was the probability of this exact string?
We ask something closer to:
What was the probability of getting a sequence this regular?
That question describes an event, not a single sequence.
For example:
A = {all ten outcomes are identical}
Now:
The event captures the pattern we cared about.
This connects information theory back to the existing distinction between:
outcome
vs
event
After observing:
HHHHHHHHHH
we might begin comparing hypotheses.
For example:
H₀ : the coin is fair
H₁ : the coin is biased toward heads
The observation can alter our relative belief in these models.
This later connects to:
- likelihood
- likelihood ratios
- Bayes' theorem
- Bayesian updating
- evidence
- KL divergence
This should be noted but not introduced in the first Information chapter.
There is also a deeper reason:
HHHHHHHHHH
can be described much more compactly than:
HTHHTTHTTH
For example:
"10 H"
is a short description.
This intuition eventually connects to:
- compression
- description length
- Kolmogorov complexity
- algorithmic information theory
This is distinct from Shannon information.
Shannon asks:
How improbable was the observation under a probability model?
Algorithmic information asks something closer to:
How short is the shortest description capable of generating it?
These become related in important ways, but they are not the same object.
This principle deserves explicit prominence.
Suppose we observe:
Head
Under:
the information is:
But under:
we obtain:
Same observation.
Different model.
Different information.
Therefore:
Information is relational: it connects an observation with an expectation.
This is one of the most important ideas for later statistical inference.
Eventually the model may depend on context.
Instead of:
we use:
and therefore:
This is central to language.
Consider:
I drink coffee with ___
A word such as:
milk
may have relatively high probability.
A word such as:
uranium
has very low probability.
Therefore:
The unusual word carries more surprisal.
It carries more information relative to that predictive context.
This distinction should be permanent in the project.
Shannon information does not measure:
- truth
- importance
- usefulness
- semantic meaning
- emotional relevance
- epistemic value
A completely meaningless random string may have very high Shannon entropy.
A profound but predictable statement may have low surprisal.
Therefore:
information ≠ meaning
The two can interact, but they should not be identified.
These can act as the local canon for the Information section.
There is no surprisal without an expectation distribution.
For independent observations:
The base defines the unit.
describes one resolved observation.
Among finite distributions over the same number of possible outcomes, the uniform distribution contains the greatest uncertainty.
Shannon information measures probabilistic uncertainty, not importance or truth.
Prediction and information are therefore inseparable.
The Information section should connect existing parts of the project rather than form an isolated branch.
A possible architecture is:
Reality
│
▼
Sample Space
Ω
│
▼
Events
𝒜
│
▼
Probability
ℙ
│
▼
Observable
X : Ω → 𝒳
│
▼
Distribution
pX
│
▼
Information
I(x)
│
▼
Entropy
H(X)
│
▼
Repeated observations
Data
│
▼
Inference / Statistics
This creates a useful progression:
What could happen?
↓
What did we observe?
↓
How likely was it?
↓
How much did we learn?
↓
What structure can repeated observations reveal?
The introductory chapter should remain intentionally narrow.
Focus on:
rare vs common events
probability as expectation
surprise as resolved expectation
I(x) = -log₂ p(x)
bits
outcome surprisal vs distribution entropy
H(X) = E[I(X)]
one light linguistic example
Do not yet develop:
conditional entropy
mutual information
KL divergence
cross-entropy
channel capacity
coding theorem
Bayesian evidence
Kolmogorov complexity
These should appear only as conceptual doors.
A simple chapter rhythm:
1. Common events teach us little.
2. Rare events attract attention.
3. Define surprisal.
4. Explain why the logarithm appears.
5. Interpret the bit.
6. Work through a small probability → bits example.
7. Distinguish observation surprisal from entropy.
8. Introduce entropy as expected surprisal.
9. Show a simple linguistic prediction example.
10. Stop.
A small interactive cell can then allow the reader to modify:
p
and observe:
without introducing additional theory.
p = 1
I = 0 bits
p = 1/2
I = 1 bit
p = 1/4
I = 2 bits
p = 1/8
I = 3 bits
p = 1/16
I = 4 bits
p = 1/1024
I = 10 bits
The pattern should be visible before becoming abstract:
Transmission of Information
Useful for the historical path toward logarithmic information and the relation:
Focus:
- distinguishable alternatives
- information as logarithm of available possibilities
- precursor to Shannon
A Mathematical Theory of Communication
Primary theoretical source.
Focus:
- entropy
- communication
- stochastic sources
- coding
- uncertainty
This should remain the canonical historical source.
Prediction and Entropy of Printed English
Particularly useful for the later linguistic hook.
Focus:
- predictability of language
- redundancy
- conditional uncertainty
- empirical estimation of language entropy
Information Theory, Inference, and Learning Algorithms
Probably the best pedagogical secondary reference for this project.
Focus:
- surprisal
- entropy
- coding
- probability
- inference
- machine learning connections
This source fits particularly well with the intended architecture of Data because it treats information theory as part of a larger theory of inference.
Elements of Information Theory
Use as the technical reference.
Focus:
- entropy
- joint entropy
- conditional entropy
- mutual information
- relative entropy
- source coding
- channel capacity
Useful for verifying definitions and formal results rather than determining the introductory narrative.
Mathematical Foundations of Information Theory
Important for the axiomatic perspective.
Focus:
Why does Shannon entropy have this particular mathematical form?
Useful later for showing that entropy is not merely an arbitrary formula: under a suitable family of natural requirements, its logarithmic form is essentially forced.
The Information section can eventually grow into several distinct paths:
Information
│
├── Surprisal
│
├── Entropy
│ ├── Joint entropy
│ └── Conditional entropy
│
├── Mutual information
│
├── Relative information
│ ├── KL divergence
│ └── Cross-entropy
│
├── Coding
│ ├── Huffman
│ ├── source coding
│ └── channel capacity
│
├── Inference
│ ├── likelihood
│ ├── Bayes
│ └── evidence
│
├── Language
│ ├── prediction
│ ├── surprisal
│ └── redundancy
│
└── Algorithmic Information
├── compression
├── description length
└── Kolmogorov complexity
These should remain separate enough that similar vocabulary does not collapse distinct concepts.
A useful conceptual statement is:
Data is an observation. Information is what that observation resolves relative to what was expected.
A shorter formulation:
Information is resolved uncertainty.
This is useful as an intuition, but should not be presented as a universal philosophical definition of all possible forms of information.
The deeper structure we want the reader eventually to recognize is:
Probability describes expectation.
Information measures the resolution of expectation.
Entropy describes expected resolution.
Data provides realized observations.
Statistics learns from their structure.
Or symbolically:
That chain should become one of the theoretical spines of Data.
Legend:
- 🔰 Start here
- 🏵️ Important Insight
- ⚙️ Technical and applications
- 💻 Some Code
- ⚜️ Advanced Topics
- 00.1 What Is Data?
-
00.2 Three Models of Reality (planned)
- 00.2.1 The Linguistic
- 00.2.2 The Symbolic
- 00.3.3 The Mathematical
- 00.3 Maps and Reality
- 00.4 Aside: Hossack, data as structure
- 00.5 Aside: Chomsky, data as evidence
- 01.1 🔰 Sets and Logic (planned)
- 01.2 Sample Space
- 01.3 Randomness and Pattern
- 01.4 Outcomes and Events
- 01.5 Finite and Infinite Sample Spaces
- 02.1 🔰 Functions (planned)
- 02.2 Types Are Alphabets
- 02.3 Random Variables: X : Ω → 𝒳 (planned)
- 02.4 Measurement Scales
- 02.5 Numerics
- 03.1 🔰 Fractions and Proportions (planned)
- 03.2 Randomness vs Uncertainty
- 03.3 Probability: Events, Conditioning, Bayes
- 03.4 Bayes' Theorem, Step by Step
- 03.5 Expected Value and Variance (planned)
- 03.6 Bernoulli (ES)
- 03.7 Discrete Uniform (ES)
- 03.8 🧗 Kolmogorov: Ω, 𝒜, ℙ
- 04.1 🔰 Powers and Logarithms (planned)
- 04.2 Rarity
- 04.3 Information Theory (Shannon)
- 04.4 Entropy: Three Views
- 05.1 🔰 Sums and Averages (planned)
- 05.2 Data, Measured
- 05.3 Sampling (ES)
- 05.4 Population and Sample (ES)
- 05.5 Types of Sampling (ES)
- 05.6 Choosing Summaries & Visuals
- 05.7 Visualization
- 05.8 Plots
- 06.1 What Is Statistics?
- 06.2 🔰 Curves and Area (planned)
- 06.3 Statistical Thinking
- 06.4 Variation
- 06.5 Uncertainty
- 06.6 Parameters vs Estimators (ES)
- 06.7 Distributions
- 06.8 Statistical Modeling
- 06.9 Statistical Methods
- 07.1 Data Storage: Databases (stub)
- 07.2 ER Diagrams
- 07.3 Chen Diagrams
- 07.4 SQL (planned)
- 07.5 Formal Languages and Regular Expressions (planned)
- 07.6 Reproducibility (planned)
08 · μ(x) — Fuzzy - When data is flexible
- 08.1 Fuzzy Logic (planned)
- 08.2 Fuzzy Numbers (planned)
- 08.3 Possibility vs Probability (planned)
09 · x(t) — Signals and systems - Where patterns live
- 09.1 Signals (stub)
- 09.2 Sampling and Aliasing (planned)
- 09.3 Convolution (planned)
- 09.4 Frequency (planned)
- 10.1 🔰 Vectors and Matrices (planned)
- 10.2 Mathematical Modelling (planned)
- 11.1 🔰 Derivatives (planned)
- 11.2 Convex Optimisation (planned)
- 12.1 Supervised Learning (planned)
- 12.2 Data in Language Models
- 13.1 Cause and Effect (planned)
- 13.2 Capstone Guide (planned)