Chi-square divergence for discrete distributions #
The Pearson χ² divergence χ²(p ‖ q) of p : PMF α with respect to reference distribution
q : PMF α (corresponding to exp(D₂(p ‖ q)) - 1, where D₂ is Rényi divergence of order 2):
echiSquare p q : ℝ≥0∞equals∑' a, ENNReal.ofReal (((p a).toReal - (q a).toReal) ^ 2) / q a, so it is⊤wheneverp.supportis not contained inq.support(on finite types).chiSquare p q : ℝis(echiSquare p q).toReal. Real-valued upper bounds and identities statep.support ⊆ q.supportexplicitly so off-support terms cannot silently vanish viax / 0 = 0.
Note that the reference/denominator distribution q is the second argument, matching
MeasureTheory.InformationTheory.klDiv p.toMeasure q.toMeasure.
Main definitions #
Cslib.Probability.PMF.echiSquare: extendedℝ≥0∞-valuedχ²divergenceχ²(p ‖ q).Cslib.Probability.PMF.chiSquare: real-valuedχ²divergence(echiSquare p q).toReal.
Main results #
Cslib.Probability.PMF.echiSquare_ne_top_iff:echiSquare p q ≠ ⊤ ↔ p.support ⊆ q.support.Cslib.Probability.PMF.chiSquare_eq_sum,chiSquare_eq_sum_div_sub_one,one_add_chiSquare_eq_sum: standard finite-sum formulas whenp.support ⊆ q.support.Cslib.Probability.PMF.one_add_echiSquare_pi,one_add_chiSquare_pi,one_add_echiSquare_iid,one_add_chiSquare_iid: product andiidtensorization1 + χ²(p^{\otimes n} ‖ q^{\otimes n}) = (1 + χ²(p ‖ q)) ^ n.Cslib.Probability.PMF.ofReal_four_mul_dist_sq_le_echiSquare,dist_le_sqrt_chiSquare_div_two,tvDist_le_sqrt_chiSquare:TV ≤ √(χ²) / 2(for half-L¹distand full-L¹tvDist).Cslib.Probability.PMF.echiSquare_bind_le,chiSquare_bind_le,chiSquare_map_le: data processing under Markov kernels and deterministic maps.Cslib.Probability.PMF.one_add_chiSquare_bind_eq,one_add_chiSquare_bind_iid_eq: the mixture second-moment identity (Ingster/Le Cam).Cslib.Probability.PMF.exp_neg_half_sum_mul_log_div_le_bhattacharyya: the classical overlap bounds the exponential of minus half the divergence.Cslib.Probability.PMF.two_mul_hellingerSq_le_toReal_klDiv,toReal_klDiv_le_log_one_add_chiSquare,toReal_klDiv_le_chiSquare,two_mul_hellingerSq_le_chiSquare: comparison hierarchy2 h² ≤ KL ≤ log(1 + χ²) ≤ χ².
References #
- Alexandre B. Tsybakov, Introduction to Nonparametric Estimation, Springer, 2009, Section 2.4.
- Clément L. Canonne, Topics and Techniques in Distribution Testing, Foundations
and Trends in Communications and Information Theory, 2022; locators checked against the
author-hosted draft (March 10, 2024): Appendix B (Definition B.1,
(B.2),(B.5), Lemmas B.2 and B.5) and Section 3.1 (Lemma 3.1 and(3.10)).
Extended Pearson χ² divergence of p with respect to q, valued in ℝ≥0∞.
It equals ∑' a, (p a - q a)² / q a when p.support ⊆ q.support, and ⊤ otherwise (on finite
types).
Real-valued Pearson χ² divergence (echiSquare p q).toReal of p with respect to q.
Real-valued theorems assume p.support ⊆ q.support so off-support mass cannot be dropped via
toReal ⊤ = 0.
Multiplicative tensorization of 1 + echiSquare over finite independent products, valid
without any support assumption.
Tensorization of 1 + chiSquare over finite independent products:
1 + χ²(pi p ‖ pi q) = ∏ i, (1 + χ²(p i ‖ q i)).
Multiplicative tensorization of 1 + echiSquare for n i.i.d. draws, valid even when n = 0
or supports are not contained.
Unconditional extended inequality ENNReal.ofReal (4 * dist p q ^ 2) ≤ echiSquare p q.
Upper bound on Mathlib's full-L¹ total variation distance via χ²:
tvDist p q ≤ √(χ²(p ‖ q)) when p.support ⊆ q.support.
Unconditional data processing inequality for extended χ² divergence under a Markov kernel,
specialized from renyiMoment_bind_le at order α = 2 (1 + χ²(p ‖ q) = renyiMoment 2 p q).
Mixture second-moment identity (Ingster / Le Cam):
for a mixture μ.bind K and reference distribution q with (K t).support ⊆ q.support for all
t ∈ μ.support,
1 + χ²(μ.bind K ‖ q) = ∑ t, ∑ t', (μ t).toReal * (μ t').toReal * ∑ a, (K t a).toReal * (K t' a).toReal / (q a).toReal.
Product mixture second-moment identity:
1 + χ²(μ.bind (fun t => pi (K t)) ‖ pi q) expressed via products of coordinate second moments.
n-fold i.i.d. mixture second-moment identity:
1 + χ²(μ.bind (fun t => iid (K t) n) ‖ iid q n) = ∑ t, ∑ t', μ(t) μ(t') (∑ a, K(t, a) K(t', a) / q(a)) ^ n.
Comparison between squared Hellinger distance and KL divergence (natural log):
2 * hellingerSq p q ≤ (klDiv p.toMeasure q.toMeasure).toReal when p.support ⊆ q.support.
KL divergence is bounded by log (1 + χ²):
(klDiv p.toMeasure q.toMeasure).toReal ≤ Real.log (1 + chiSquare p q).
KL divergence (natural log) is at most Pearson χ² divergence:
(klDiv p.toMeasure q.toMeasure).toReal ≤ chiSquare p q.