Documentation

CslibFrontier.MachineLearning.PACLearning.VCUniformConvergence

Uniform convergence from the growth function on countable domains #

Let G be a class of Boolean functions on a countable domain Z with measurable singletons and let μ be a probability measure on Z. The uniform convergence theorem of Vapnik and Chervonenkis bounds the probability that the relative frequency of some event {g = true}, g ∈ G, in m i.i.d. samples differs from its probability by at least ε:

μ^m {S | ∃ g ∈ G, ε ≤ |#{i | g (S i)} / m - μ {g = true}|} ≤ 4 Π_G(2m) exp (-m ε² / 8),

where Π_G is the growth function [VapnikChervonenkis1971; AnthonyBartlett1999, Theorem 4.3]. Applied to the loss class of a binary concept class C and a distribution D on labeled examples, this says that m i.i.d. examples fail to be ε-representative for C (in the sense of [ShalevShwartzBenDavid2014, Definition 4.1]) with probability at most 4 Π_C(2m) exp (-m ε² / 8). With Sauer's lemma, the explicit sample size

uniformConvergenceSampleSize d ε δ = (16 / ε²) (2 d log (10 / ε) + log (4 / δ))

brings the failure probability below δ when every set shattered by C has at most d points.

The proof is the double-sample symmetrization argument, with the measure-theoretic steps from DoubleSample.lean.

The ghost-sample step is stated separately, for any bound on the fraction of bad swaps (measure_pi_exists_le_abs_card_filter_div_sub_measure_le_of_card_filter_swapSamples_le); AgnosticVCSharp.lean bounds that fraction by chaining instead of the union over labelings.

The theorem is stated with ≤ |…| (a deviation of at least ε), which is slightly stronger than the strict form > ε in the sources, and for all ε ≥ 0 and m; when 4 Π_G(2m) exp (-m ε² / 8) is at least 1 it is trivial. The domain is assumed countable with measurable singletons, so that every set of samples is measurable. Over general domains the theorem needs a measurability hypothesis on the class, which is not formalized here.

Main definitions #

Main results #

References #

Counting swaps #

Uniform convergence #

theorem Cslib.MachineLearning.PACLearning.measure_pi_exists_le_abs_card_filter_div_sub_measure_le_of_card_filter_swapSamples_le {Z : Type u_1} [MeasurableSpace Z] [MeasurableSingletonClass Z] [Countable Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure μ] (G : ConceptClass Z Bool) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) (hexp : 4 * Real.exp (-(↑m * ε ^ 2 / 2)) ≤ 1) {β : ℝ} (hβ : ∀ (z : (Fin m → Z) × (Fin m → Z)), ↑{σ : Fin m → Bool | ∃ g ∈ G, ↑m * ε / 2 ≤ |↑{i : Fin m | g ((swapSamples σ z).1 i) = true}.card - ↑{i : Fin m | g ((swapSamples σ z).2 i) = true}.card|}.card ≤ 2 ^ m * β) :
(MeasureTheory.Measure.pi fun (x : Fin m) => μ) {S : Fin m → Z | ∃ g ∈ G, ε ≤ |↑{i : Fin m | g (S i) = true}.card / ↑m - (μ {z : Z | g z = true}).toReal|} ≤ ENNReal.ofReal (2 * β)

The ghost-sample step of double-sample symmetrization on a countable domain: suppose that for every double sample z, at most a β fraction of the 2 ^ m swaps σ give some g ∈ G counts on the two swapped samples that differ by at least m ε / 2, and that 4 exp (-m ε² / 2) ≤ 1. Then the probability that the relative frequency of some {g = true}, g ∈ G, in m i.i.d. samples deviates from μ {g = true} by at least ε is at most 2 β. Hoeffding's inequality puts the count of a fixed g on an independent ghost sample within m ε / 2 of m μ {g = true} with probability at least 1 / 2, and swapping coordinates preserves the law of the double sample.

theorem Cslib.MachineLearning.PACLearning.measure_pi_exists_le_abs_card_filter_div_sub_measure_le {Z : Type u_1} [MeasurableSpace Z] [MeasurableSingletonClass Z] [Countable Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure μ] (G : ConceptClass Z Bool) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
(MeasureTheory.Measure.pi fun (x : Fin m) => μ) {S : Fin m → Z | ∃ g ∈ G, ε ≤ |↑{i : Fin m | g (S i) = true}.card / ↑m - (μ {z : Z | g z = true}).toReal|} ≤ ENNReal.ofReal (4 * ↑(growthFunction G (m + m)) * Real.exp (-(↑m * ε ^ 2 / 8)))

Uniform convergence of relative frequencies on a countable domain [VapnikChervonenkis1971; AnthonyBartlett1999, Theorem 4.3]: under m i.i.d. samples from μ, the probability that the relative frequency of {g = true} deviates from μ {g = true} by at least ε for some g ∈ G is at most 4 Π_G(2m) exp (-m ε² / 8).

Uniform convergence of empirical errors on a countable domain [VapnikChervonenkis1971; AnthonyBartlett1999, Theorem 4.3]: under m i.i.d. examples from D, the probability that the empirical error of some h ∈ C deviates from its error by at least ε is at most 4 Π_C(2m) exp (-m ε² / 8).

Uniform convergence for a class with a bounded growth function on a countable domain [VapnikChervonenkis1971; AnthonyBartlett1999, Theorem 4.3]: m i.i.d. examples fail to be ε-representative for C with probability at most 4 Π_C(2m) exp (-m ε² / 8).

The explicit sample size #

The uniform convergence sample size (16 / ε²) (2 d log (10 / ε) + log (4 / δ)).

theorem Cslib.MachineLearning.PACLearning.four_mul_growthFunction_mul_exp_le_of_uniformConvergenceSampleSize_le {Z : Type u_1} {G : ConceptClass Z Bool} {d : ℕ} (hG : ∀ (W : Finset Z), SetShatters G ↑W → W.card ≤ d) {m : ℕ} {ε δ : ℝ} (hε : 0 < ε) (hε10 : ε ≤ 10) (hδ : 0 < δ) (hm : uniformConvergenceSampleSize d ε δ ≤ ↑m) :
4 * ↑(growthFunction G (m + m)) * Real.exp (-(↑m * ε ^ 2 / 8)) ≤ δ

The explicit sample size makes 4 Π_G(2m) exp (-m ε² / 8) ≤ δ 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 = (10 / ε)².

theorem Cslib.MachineLearning.PACLearning.measure_pi_not_isRepresentative_le_of_uniformConvergenceSampleSize_le {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] (D : MeasureTheory.Measure (α × Bool)) [MeasureTheory.IsProbabilityMeasure D] {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} {ε δ : ℝ} (hε : 0 < ε) (hε10 : ε ≤ 10) (hδ : 0 < δ) (hm : uniformConvergenceSampleSize d ε δ ≤ ↑m) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × Bool | ¬IsRepresentative D C ε S} ≤ ENNReal.ofReal δ

Uniform convergence with an explicit sample size on a countable domain: if every finite set shattered by C has at most d points and m ≥ (16 / ε²) (2 d log (10 / ε) + log (4 / δ)), then m i.i.d. examples fail to be ε-representative for C with probability at most δ.