Information Theory & Entropy
Information Theory & Entropy
What is Information Theory?
Information theory studies:
-
how information is measured
-
how much uncertainty exists in data
-
how efficiently information can be encoded or transmitted
Introduced by Claude Shannon, it forms the basis of:
-
Data compression (ZIP, JPEG)
-
Machine learning loss functions
-
Communication systems
-
Cryptography
What is Entropy?
✅ Definition
Entropy measures the uncertainty or randomness in a probability distribution.
-
High entropy → very unpredictable outcome
-
Low entropy → predictable outcome
π Formula
For probabilities
Unit = bits
Intuition
| Situation | Entropy |
|---|---|
| Fair coin | High uncertainty → High entropy |
| Biased coin (always heads) | No uncertainty → Entropy = 0 |
| Uniform distribution | Maximum entropy |
Example Calculations
π² Example 1 — Fair Coin
π Interpretation: Need 1 bit to encode outcome.
π² Example 2 — Biased Coin
π Less uncertainty → lower entropy.
π² Example 3 — Deterministic Outcome
π No uncertainty → zero information needed.
Significance of Entropy
π In Machine Learning
-
Measures impurity in decision trees
-
Used in information gain
-
Basis for cross-entropy loss
π In Communication
-
Minimum number of bits needed to encode message
-
Guides optimal compression schemes
π In Probability & Statistics
-
Quantifies unpredictability
-
Helps compare distributions
Python Code to Compute Entropy
✅ Basic Function
Visualization Code
π Shows entropy is maximum at p = 0.5
Summary
Entropy = amount of surprise in the outcome.
-
Predictable event → low entropy
-
Random event → high entropy

Comments
Post a Comment