Documentation

CslibFrontier.MachineLearning.PACLearning.GrowthFunction

The growth function and Sauer's lemma #

For a binary concept class C and points x₀, …, x_{m-1} of the domain, the restriction of C to x is the set of labelings (c x₀, …, c x_{m-1}) realized by concepts c ∈ C [ShalevShwartzBenDavid2014, Definition 6.2]. The growth function growthFunction C m is the largest number of such labelings over all choices of m points [ShalevShwartzBenDavid2014, Definition 6.9]. Points are given as a sequence Fin m → α, so repetitions are allowed; repeated points never add labelings, so for a domain with at least m points this is the maximum over m-element subsets used by Shalev-Shwartz and Ben-David.

Sauer's lemma bounds the growth function of a class all of whose shattered sets have at most d points by ∑_{i ≤ d} (m choose i), hence by (e m / d) ^ d for d ≤ m and by (m + 1) ^ d [ShalevShwartzBenDavid2014, Lemma 6.10]. The combinatorial core is the Sauer–Shelah lemma for finite set families in Mathlib (Finset.card_le_card_shatterer), applied to the supports of the realized labelings.

The main bounds take the hypothesis "every shattered finite set has at most d points" rather than a bound on vcDim, since vcDim is only meaningful under HasFiniteVCDim; the vcDim forms follow (growthFunction_le_sum_choose_vcDim).

Main definitions #

Main results #

References #

def Cslib.MachineLearning.PACLearning.restriction {α : Type u_1} (C : ConceptClass α Bool) {m : ℕ} (x : Fin m → α) :
Set (Fin m → Bool)

The restriction of a binary concept class C to the points x : Fin m → α: the set of labelings i ↦ c (x i) realized by concepts c ∈ C [ShalevShwartzBenDavid2014, Definition 6.2].

noncomputable def Cslib.MachineLearning.PACLearning.growthFunction {α : Type u_1} (C : ConceptClass α Bool) (m : ℕ) :

The growth function of a binary concept class C: the largest number of labelings of m points realized by concepts of C [ShalevShwartzBenDavid2014, Definition 6.9].

theorem Cslib.MachineLearning.PACLearning.mem_restriction {α : Type u_1} {C : ConceptClass α Bool} {m : ℕ} {x : Fin m → α} {v : Fin m → Bool} :
v ∈ restriction C x ↔ ∃ c ∈ C, ∀ (i : Fin m), c (x i) = v i
theorem Cslib.MachineLearning.PACLearning.restriction_mono {α : Type u_1} {C C' : ConceptClass α Bool} (h : C ⊆ C') {m : ℕ} (x : Fin m → α) :
theorem Cslib.MachineLearning.PACLearning.growthFunction_le {α : Type u_1} {C : ConceptClass α Bool} {m n : ℕ} (h : ∀ (x : Fin m → α), (restriction C x).ncard ≤ n) :

A finite class realizes at most |H| labelings of any points.

If C shatters a finite set W, then the growth function attains its maximum 2 ^ |W| at |W|.

theorem Cslib.MachineLearning.PACLearning.ncard_restriction_le_sum_choose {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} (x : Fin m → α) :
(restriction C x).ncard ≤ ∑ i ∈ Finset.range (d + 1), m.choose i

Sauer's lemma for one choice of points: if every finite set shattered by C has at most d points, then C realizes at most ∑_{i ≤ d} (m choose i) labelings of any m points [ShalevShwartzBenDavid2014, Lemma 6.10].

theorem Cslib.MachineLearning.PACLearning.growthFunction_le_sum_choose {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (m : ℕ) :
growthFunction C m ≤ ∑ i ∈ Finset.range (d + 1), m.choose i

Sauer's lemma [ShalevShwartzBenDavid2014, Lemma 6.10]: if every finite set shattered by C has at most d points, then growthFunction C m ≤ ∑_{i ≤ d} (m choose i).

theorem Cslib.MachineLearning.PACLearning.growthFunction_le_add_one_pow {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (m : ℕ) :
growthFunction C m ≤ (m + 1) ^ d

Polynomial form of Sauer's lemma: growthFunction C m ≤ (m + 1) ^ d.

theorem Cslib.MachineLearning.PACLearning.growthFunction_le_exp_one_mul_div_pow {α : Type u_1} {C : ConceptClass α Bool} {d m : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (hdm : d ≤ m) :
↑(growthFunction C m) ≤ (Real.exp 1 * ↑m / ↑d) ^ d

Sauer's lemma in the form growthFunction C m ≤ (e m / d) ^ d for d ≤ m [ShalevShwartzBenDavid2014, Lemma 6.10, which states it for m > d + 1]. At d = 0 both sides are at most one.

theorem Cslib.MachineLearning.PACLearning.growthFunction_le_exp_mul_pow {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (m : ℕ) {T : ℝ} (hT : 1 ≤ T) :
↑(growthFunction C m) ≤ Real.exp (↑m / T) * T ^ d

Sauer's lemma in the form growthFunction C m ≤ exp (m / T) * T ^ d for every real T ≥ 1. Unlike growthFunction_le_exp_one_mul_div_pow, it needs no relation between d and m; sample size bounds choose T to trade the exponential factor against the polynomial one.

Sauer's lemma in terms of the VC dimension, for a class of finite VC dimension.