Documentation

CslibFrontier.MachineLearning.PACLearning.EpsilonNet

The ε-net theorem on countable domains #

Let G be a class of Boolean functions on a domain Z and μ a probability measure on Z. A sample S : Fin m → Z is an ε-net for G under μ if every g ∈ G with μ {g = true} ≥ ε takes the value true at some sample point [HausslerWelzl1987; ShalevShwartzBenDavid2014, Section 28.3]. The ε-net theorem says that m i.i.d. samples fail to be an ε-net with probability at most 2 Π_G(2m) 2^(-εm/2) once εm ≥ 8, where Π_G is the growth function [ShalevShwartzBenDavid2014, Section 28.3; see also BlumerEhrenfeuchtHausslerWarmuth1989]. With Sauer's lemma this gives the sample size

m ≥ (8 / ε) (d log (48 / ε) + log (4 / δ))

for failure probability at most δ when every set shattered by G has at most d points. The constants differ from those of the cited sources but have the same form.

The proof is the double-sample symmetrization argument. If some g with μ {g = true} ≥ ε misses the first sample, then by the Chernoff lower tail a second independent sample has at least εm / 2 points with g = true with probability at least 1 / 2. So the bad event has probability at most twice that of the double-sample event: some g ∈ G is false on the first sample and true on at least k = ⌈εm / 2⌉ points of the second. Swapping any set of coordinates between the two samples preserves the product measure. For a fixed double sample, at most Π_G(2m) 2^(m - k) of the 2^m swaps land in the double-sample event, because each realized labeling of the 2m points is compatible with at most 2^(m - k) swaps. The measure-theoretic steps of this argument (the ghost sample and swap averaging) are in DoubleSample.lean.

The domain is assumed countable with measurable singletons, so every set of samples is measurable. Over general domains the theorem needs a measurability hypothesis on the class (the "well-behaved" classes of [BEHW89]); that case is not formalized here.

Main definitions #

Main results #

References #

Counting swaps #

The explicit sample size #

noncomputable def Cslib.MachineLearning.PACLearning.vcSampleSize (d : ℕ) (ε δ : ℝ) :

The VC sample size (8 / ε) (d log (48 / ε) + log (4 / δ)).

theorem Cslib.MachineLearning.PACLearning.le_of_vcSampleSize_le {d m : ℕ} {ε δ N : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hδ : 0 < δ) (hδ1 : δ ≤ 1) (hm : vcSampleSize d ε δ ≤ ↑m) (hN : N ≤ Real.exp (↑(m + m) / (48 / ε)) * (48 / ε) ^ d) :
8 ≤ ε * ↑m ∧ 2 * N ≤ δ * 2 ^ ⌈ε * ↑m / 2⌉₊

The sample-size calculation behind growthFunction_le_of_vcSampleSize_le: if vcSampleSize d ε δ ≤ m and N ≤ exp (2m / (48 / ε)) (48 / ε) ^ d, then 8 ≤ εm and 2 N ≤ δ 2 ^ ⌈εm/2⌉. Factored out so multiclass bounds can instantiate it at rescaled confidence δ / k ^ (2 d).

theorem Cslib.MachineLearning.PACLearning.growthFunction_le_of_vcSampleSize_le {Z : Type u_1} {G : ConceptClass Z Bool} {d : ℕ} (hG : ∀ (W : Finset Z), SetShatters G ↑W → W.card ≤ d) {m : ℕ} {ε δ : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hδ : 0 < δ) (hδ1 : δ ≤ 1) (hm : vcSampleSize d ε δ ≤ ↑m) :
8 ≤ ε * ↑m ∧ 2 * ↑(growthFunction G (m + m)) ≤ δ * 2 ^ ⌈ε * ↑m / 2⌉₊

The explicit sample size makes 2 Π_G(2m) ≤ δ 2 ^ ⌈εm/2⌉ (and 8 ≤ εm) whenever every finite set shattered by G has at most d points. The proof applies Sauer's lemma in the form Π_G(2m) ≤ exp (2m / T) T ^ d (growthFunction_le_exp_mul_pow) at T = 48 / ε.

ε-nets #

The sample S is an ε-net for the class G under the measure μ: every g ∈ G with μ {g = true} ≥ ε takes the value true at some sample point [HW87].

theorem Cslib.MachineLearning.PACLearning.not_isEpsNet_iff {Z : Type u_1} [MeasurableSpace Z] {μ : MeasureTheory.Measure Z} {G : ConceptClass Z Bool} {ε : ℝ} {m : ℕ} {S : Fin m → Z} :
¬IsEpsNet μ G ε S ↔ ∃ g ∈ G, ENNReal.ofReal ε ≤ μ {z : Z | g z = true} ∧ ∀ (i : Fin m), g (S i) = false

The ε-net theorem #

The ε-net theorem on a countable domain [ShalevShwartzBenDavid2014, Section 28.3; see also BlumerEhrenfeuchtHausslerWarmuth1989]: if 8 ≤ εm, then m i.i.d. samples from μ fail to be an ε-net for G with probability at most 2 Π_G(2m) / 2 ^ ⌈εm/2⌉.

The ε-net theorem in δ form: if 8 ≤ εm and 2 Π_G(2m) ≤ δ 2 ^ ⌈εm/2⌉, then m i.i.d. samples fail to be an ε-net with probability at most δ.

theorem Cslib.MachineLearning.PACLearning.measure_pi_not_isEpsNet_le_of_vcSampleSize_le {Z : Type u_1} [MeasurableSpace Z] [MeasurableSingletonClass Z] [Countable Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure μ] {G : ConceptClass Z Bool} {d : ℕ} (hG : ∀ (W : Finset Z), SetShatters G ↑W → W.card ≤ d) {ε δ : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hδ : 0 < δ) (hδ1 : δ ≤ 1) {m : ℕ} (hm : vcSampleSize d ε δ ≤ ↑m) :
(MeasureTheory.Measure.pi fun (x : Fin m) => μ) {S : Fin m → Z | ¬IsEpsNet μ G ε S} ≤ ENNReal.ofReal δ

The ε-net theorem with an explicit sample size on a countable domain [BlumerEhrenfeuchtHausslerWarmuth1989; ShalevShwartzBenDavid2014, Section 28.3]: if every finite set shattered by G has at most d points and m ≥ (8 / ε) (d log (48 / ε) + log (4 / δ)), then m i.i.d. samples fail to be an ε-net for G with probability at most δ. The constants differ from those of the cited sources but have the same form.