Documentation

CslibFrontier.MachineLearning.Rademacher.Chaining

Rademacher complexity of VC classes by chaining #

Massart's lemma bounds the empirical Rademacher complexity of a binary class C on m points by √(2 log Π_C(m) / m), which is √(2 d log (e m / d) / m) when every set shattered by C has at most d points (empiricalRademacherComplexity_signClass_le_vc). Chaining removes the logarithm. On a sample, the sign patterns signVal ∘ u of the labelings u realized by C satisfy ‖signVal ∘ u - signVal ∘ v‖² = 4 · hammingDist u v. A maximal separated set of labelings at Hamming scale m / 4 ^ (n + 1) is a Euclidean net of the sign patterns at scale √m / 2 ^ n, and by the packing bound (card_le_div_pow_of_le_hammingDist) it has at most 2 ^ (2 d (2 n + 5)) points. Dudley's chaining bound (Cslib.BitString.expect_ciSup_sum_mul_signVal_le_chaining) with these nets, and T 0 = {0}, gives the complexity bound 32 √(d / m). The argument uses only that the vectors depend on realized labelings with squared distances at most a multiple of the Hamming distance, so expect_ciSup_sum_mul_signVal_le_of_hammingDist states it in that generality; other vectors, such as the loss differences on a double sample, have the same nets.

The constant 32 is far from optimal: for realistic sample sizes the logarithmic bound is smaller. The point is the rate, which is what the sharp agnostic sample complexity O((d + log (1 / δ)) / ε²) of [ShalevShwartzBenDavid2014, Theorem 6.8] needs.

Main results #

References #

theorem Cslib.MachineLearning.expect_ciSup_sum_mul_signVal_le_of_hammingDist {α : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype κ] [DecidableEq κ] {C : PACLearning.ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), PACLearning.SetShatters C ↑W → W.card ≤ d) {n : ℕ} (x : Fin n → α) (ℓ : ι → Fin n → Bool) (hℓ : ∀ (j : ι), ℓ j ∈ PACLearning.restriction C x) (a : ι → κ → ℝ) {r : ℝ} (hr : 0 ≤ r) (ha : ∀ (j : ι), ∑ i : κ, a j i ^ 2 ≤ r ^ 2) (hdist : ∀ (j j' : ι), ∑ i : κ, (a j i - a j' i) ^ 2 ≤ 4 * r ^ 2 / ↑n * ↑(hammingDist (ℓ j) (ℓ j'))) :
(Finset.univ.expect fun (σ : κ → Bool) => ⨆ (j : ι), ∑ i : κ, a j i * BitString.signVal (σ i)) ≤ 32 * r * √↑d

Chaining over the labelings of a VC class, derived from the chaining bound [ShalevShwartzBenDavid2014, Lemma 27.4] as in [Vershynin2018, Section 8.3]: let every finite set shattered by C have at most d points, and let a j : κ → ℝ, j : ι, be vectors of Euclidean norm at most r that depend on j only through a labeling ℓ j realized by C on n points x, with ‖a j - a j'‖² ≤ (4 r² / n) · hammingDist (ℓ j) (ℓ j'). Then the expected maximum of their correlations with a uniformly random sign vector is at most 32 r √d.

The nets are images of maximal Hamming-separated sets of labelings at scales n / 4 ^ (k + 1), bounded by the packing bound card_le_div_pow_of_le_hammingDist; the truncation level of Cslib.BitString.expect_ciSup_sum_mul_signVal_le_chaining is then sent to infinity.

Chaining bound for VC classes, derived from the chaining bound [ShalevShwartzBenDavid2014, Lemma 27.4] as in [Vershynin2018, Section 8.3]: if every finite set shattered by C has at most d points, the empirical Rademacher complexity of signClass C on m points is at most 32 √(d / m). Unlike empiricalRademacherComplexity_signClass_le_vc, the bound has no factor log (m / d).

theorem Cslib.MachineLearning.rademacherComplexity_signClass_le_mul_sqrt {α : Type u_1} [Fintype α] (D : PMF α) {C : PACLearning.ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), PACLearning.SetShatters C ↑W → W.card ≤ d) (m : ℕ) :
rademacherComplexity D (signClass C) m ≤ 32 * √(↑d / ↑m)

Chaining bound for VC classes for the Rademacher complexity on a finite domain.

theorem Cslib.MachineLearning.PACLearning.IsERM.vc_agnostic_bound_mul_sqrt {α : Type u_1} [Finite α] (D : PMF (α × Bool)) {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} (hm : 0 < m) {A : Learner α Bool m} (hA : IsERM A C) {δ : ℝ} (hδ : 0 < δ) :
((Probability.PMF.pi fun (x : Fin m) => D).toOuterMeasure {S : Fin m → α × Bool | ∃ c ∈ C, (D.toOuterMeasure {p : α × Bool | c p.1 ≠ p.2}).toReal + 32 * √(↑d / ↑m) + √(2 * Real.log (2 / δ) / ↑m) < (D.toOuterMeasure {p : α × Bool | A S p.1 ≠ p.2}).toReal}).toReal ≤ δ

Agnostic VC bound without a logarithmic factor: if every finite set shattered by C has at most d points, then for m > 0, with probability at least 1 - δ over m independent examples from D, an empirical risk minimizer A for C satisfies err_D(A S) ≤ err_D(c) + 32 √(d / m) + √(2 log (2 / δ) / m) for every c ∈ C. This is an excess error of O(√((d + log (1 / δ)) / m)), the rate of [ShalevShwartzBenDavid2014, Theorem 6.8]. It combines PACLearning.IsERM.rademacherComplexity_agnostic_bound with the chaining bound. The domain is finite.