Tensor by Tensor

MODULE 01 · LESSON 06

Entropy

Entropy measures uncertainty. KL divergence compares two probability distributions.

PLAIN-LANGUAGE INTRODUCTION

What is this?

Entropy measures uncertainty. KL divergence compares two probability distributions.

One simple example

Use coin probabilities p=[0.75,0.25] and q=[0.5,0.5]. Then H(p)=0.811 bits and KL(p||q)=0.189 bits.

What goes in?

Probability lists whose values add to 1.

What comes out?

Uncertainty for one list or extra coding cost between two lists.

Why does it matter?

These measures describe uncertain targets and mismatched model probabilities.

What is it not?

KL divergence is not symmetric. Swapping p and q can change it.

WORK THROUGH THE IDEA

See the idea in more detail

  1. A probability states how often an outcome is expected. Here, heads has 0.75. Tails has 0.25.
  2. Entropy uses H(p) = −Σ p log₂ p. The symbol Σ means add one term per outcome.
  3. For p, entropy is about 0.811 bits. The fair distribution q has 1 bit.
  4. Using q for outcomes from p costs 1 bit. The extra cost is 1 − 0.811 = 0.189 bits.
  5. Common mistake: KL is not an ordinary distance. Its direction matters.
Open the detailed notes ↗