Documentation

CslibFrontier.Probability.JensenShannon

Jensen–Shannon divergence and squared Hellinger distance #

Defines the Jensen–Shannon divergence in bits (jensenShannon) for arbitrary finite probability mass functions, establishes its entropy decomposition (jensenShannon_eq_entropy_sub), and proves the quadratic Hellinger comparison hellingerSq p q / 2 ≤ jensenShannon p q (half_hellingerSq_le_jensenShannon).

Main definitions #

Main results #

Jensen–Shannon divergence and squared Hellinger distance #

noncomputable def Cslib.Probability.PMF.jensenShannon {α : Type u_1} [Finite α] (p q : PMF α) :

The Jensen–Shannon divergence (in bits) between two finite distributions p and q, defined as the mutual information I(B : Z) when B ~ Unif(Bool) selects p (false) or q (true).

theorem Cslib.Probability.PMF.jensenShannon_eq_entropy_sub {α : Type u_1} [Finite α] (p q : PMF α) :
jensenShannon p q = entropy ((uniformOfFintype Bool).bind fun (b : Bool) => bif b then q else p) - (entropy p + entropy q) / 2

Explicit entropy formula for Jensen–Shannon divergence: JS(p, q) = H((p + q) / 2) - (H(p) + H(q)) / 2.

Jensen–Shannon divergence (in bits) is at least half the squared Hellinger distance: hellingerSq p q / 2 ≤ jensenShannon p q.