Documentation

FormalSLT.PACBayes.FiniteEmpiricalVariance

Finite empirical-variance foundations for PAC-Bayes #

This module isolates the deterministic variance objects used by finite PAC-Bayes empirical-Bernstein arguments:

Proof strategy: finite-sum algebra proves the deterministic identities; a coordinate-swap equivalence proves the finite-IID marginal identity; finite-sum reordering then proves unbiasedness.

The ordered representation is the finite U-statistic form

(2 n (n - 1))⁻¹ ∑ᵢ ∑_{j ≠ i} (xᵢ - xⱼ)².

Equivalently, it is (n (n - 1))⁻¹ times the sum over unordered pairs. This module does not prove an exponential-moment inequality, a confidence event, or a PAC-Bayes empirical-Bernstein theorem. The object is per hypothesis; it is not the variance of a posterior-averaged loss. Substantive sample-variance results assume n ≥ 2.

The normalization follows Tolstikhin and Seldin (2013), "PAC-Bayes-Empirical-Bernstein Inequality," equation (5). The ordered-pair identity is the equivalent second-order U-statistic representation used in the empirical-Bernstein literature; see also Maurer and Pontil (2009), "Empirical Bernstein Bounds and Sample Variance Penalization."

def FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePopulationVariance {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) ( : ιZ) (i : ι) :

Population variance of the loss of hypothesis i under a finite PMF.

Equations
Instances For
    noncomputable def FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteEmpiricalVariance {ι : Type u_1} {Z : Type u_2} {n : } ( : ιZ) (i : ι) (S : Fin nZ) :

    Bessel-corrected empirical variance of the losses observed in S.

    The denominator is n - 1; substantive theorems below assume 2 ≤ n.

    Equations
    Instances For

      Sum of squared differences over ordered, distinct sample-index pairs.

      Equations
      Instances For
        noncomputable def FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePairwiseEmpiricalVariance {ι : Type u_1} {Z : Type u_2} {n : } ( : ιZ) (i : ι) (S : Fin nZ) :

        Ordered-pair realization of the empirical-variance U-statistic.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePopulationVariance_nonneg {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) :

          Population variance is nonnegative under a finite PMF.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePopulationVariance_eq_secondMoment_sub_riskSq {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) :

          Population variance is the second moment minus the squared population risk.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePopulationRisk_mem_Icc_of_bounded {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) (hℓ : ∀ (z : Z), i z Set.Icc 0 1) :

          A finite [0,1]-valued loss has population risk in [0,1].

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePopulationVariance_le_quarter {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) (hℓ : ∀ (z : Z), i z Set.Icc 0 1) :

          The population variance of a finite [0,1]-valued loss is at most 1/4.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteEmpiricalVariance_nonneg {ι : Type u_1} {Z : Type u_2} {n : } (hn : 2 n) ( : ιZ) (i : ι) (S : Fin nZ) :

          Bessel-corrected empirical variance is nonnegative for n ≥ 2.

          The ordered off-diagonal squared-difference sum is twice n times the centered sum of squares.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteEmpiricalVariance_eq_pairwise {ι : Type u_1} {Z : Type u_2} {n : } (hn : 2 n) ( : ιZ) (i : ι) (S : Fin nZ) :

          Exact source-facing pairwise identity for the finite empirical variance.

          The ordered sum counts each unordered pair twice, which accounts for the factor 2 in the denominator.

          Ordered pairwise numerator bound for a sample taking values in [0,1].

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteEmpiricalVariance_le_card_div_pred_mul_empiricalRisk {ι : Type u_1} {Z : Type u_2} {n : } (hn : 2 n) ( : ιZ) (i : ι) (S : Fin nZ) (hℓ : ∀ (k : Fin n), i (S k) Set.Icc 0 1) :

          For samples whose observed losses lie in [0,1], empirical variance is at most n / (n - 1) times empirical risk. This is the deterministic comparison used in Tolstikhin--Seldin after their equation (7).

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteEmpiricalVariance_le_half {ι : Type u_1} {Z : Type u_2} {n : } (hn : 2 n) ( : ιZ) (i : ι) (S : Fin nZ) (hℓ : ∀ (k : Fin n), i (S k) Set.Icc 0 1) :

          A Bessel-corrected empirical variance of [0,1] observations is at most 1/2.

          Finite iid expectation identities #

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteProductSampleWeight_pairExpectation {Z : Type u_2} {n : } [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) (k j : Fin n) (hkj : k j) (g : ZZ) :
          S : Fin nZ, PACBayesFiniteProductMGF.finiteProductSampleWeight p S * g (S k) (S j) = z : Z, w : Z, p z * p w * g z w

          Two distinct coordinates of a finite iid product sample have the expected product marginal.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finitePairVarianceKernelExpectation_eq_populationVariance {ι : Type u_1} {Z : Type u_2} [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) :
          z : Z, w : Z, p z * p w * (( i z - i w) ^ 2 / 2) = finitePopulationVariance p i

          The expected independent-pair squared-difference kernel is the population variance.

          theorem FormalSLT.PACBayes.FiniteEmpiricalVariance.finiteProductSampleWeight_pairSquaredDifferenceExpectation_eq {ι : Type u_1} {Z : Type u_2} {n : } [Fintype Z] (p : Z) (hp : PACBayesKL.IsPMF p) ( : ιZ) (i : ι) (k j : Fin n) (hkj : k j) :
          S : Fin nZ, PACBayesFiniteProductMGF.finiteProductSampleWeight p S * ( i (S k) - i (S j)) ^ 2 = 2 * finitePopulationVariance p i

          For two distinct sample coordinates, the expected squared loss difference is twice the population variance.

          The Bessel-corrected empirical loss variance is unbiased under the finite iid product sample law.