Comment

Comment by jwarden

Here's how I describe KL Divergence, building up from simple to complex concepts.

surprisal: how surprised I am when I learn the value of X

  Suprisal(x) = -log p(X=x)
entropy: how surprised I expect to be

  H(p)        = ๐”ผ_X -log p(X) 
              = โˆ‘_x p(X=x) * -log p(X=x)
cross-entropy: how surprised I expect Bob to be (if Bob's beliefs are q instead of p)

  H(p,q)      = ๐”ผ_X -log q(X) 
              = โˆ‘_x p(X=x) * -log q(X=x)
KL divergence: how much *more* surprised I expect Bob to be than me

  Dkl(p || q) = H(p,q) - H(p,p)
              = โˆ‘_x p(X=x) * log p(X=x)/q(X=x)
information gain: how much less surprised I expect Bob to be if he knew that Y=y

  IG(q|Y=y)   = Dkl(q(X|Y=y) || q(X))
mutual information: how much information I expect to gain about X from learning the value of Y

  I(X;Y)      = ๐”ผ_Y IG(q|Y=y)
                ๐”ผ_Y Dkl(q(X|Y=y) || q(X))
parent jwarden 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News ยท SvelteKit + Skeleton