Documentation

CslibFrontier.MachineLearning.PACLearning.Packing

Packing numbers of a binary class on a sample #

Fix points x : Fin m → α and a binary concept class C. A set P of labelings of x realized by C is ε-separated if any two distinct labelings in P differ on at least ε m of the points, i.e. their normalized Hamming distance is at least ε. This file bounds the size of such a set by the growth function, and hence, by Sauer's lemma, by a power of 1 / ε whose exponent is proportional to the VC dimension and independent of m.

The argument is subsampling [Vershynin2018, Lemma 8.3.19 and Theorem 8.3.18]. A uniformly random tuple t of k indices separates a fixed pair of ε-separated labelings unless all k indices land where they agree, which happens with probability at most (1 - ε) ^ k ≤ exp (-ε k). When |P|² exp (-ε k) < 1, some t separates every pair, so the labelings in P stay distinct on the k points x ∘ t and |P| ≤ Π_C(k). The proof counts the tuples directly. Taking k = ⌊2 log |P| / ε⌋ + 1 and the form Π_C(k) ≤ exp (k / T) T ^ d of Sauer's lemma with T = 4 / ε gives |P| ≤ (8 / ε) ^ (2 d) when every set shattered by C has at most d points. This is Dudley's bound, with a constant in the exponent; Haussler's sharper e (d + 1) (2 e / ε) ^ d is proved in CslibFrontier/MachineLearning/PACLearning/HausslerPacking.lean.

A maximal separated subset is also a net at the same scale (Cslib.Code.exists_subset_pairwise_lt_hammingDist_forall_exists_le), so the bound also limits the size of nets. Chaining arguments need nets at every scale whose sizes grow polynomially in 1 / ε. They give the agnostic sample complexity O((d + log (1 / δ)) / ε²) stated in [ShalevShwartzBenDavid2014, Theorem 6.8]. That book proves only the weaker O((d log (d / ε) + log (1 / δ)) / ε²) (Section 28.1), leaving out the chaining argument (Lemma 27.4) that the sharp form needs.

Main results #

References #

theorem Cslib.MachineLearning.PACLearning.exists_injOn_comp_of_two_mul_log_card_lt {β : Type u_2} [DecidableEq β] {m k : ℕ} (hm : 0 < m) (P : Finset (Fin m → β)) {ε : ℝ} (hP : ∀ u ∈ P, ∀ v ∈ P, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) (hk : 2 * Real.log ↑P.card < ε * ↑k) :
∃ (t : Fin k → Fin m), Set.InjOn (fun (u : Fin m → β) (j : Fin k) => u (t j)) ↑P

Subsampling. If any two distinct words in P differ in at least ε m of their m letters and 2 log |P| < ε k, then some k of the positions, possibly repeated, already distinguish all words in P.

theorem Cslib.MachineLearning.PACLearning.card_le_growthFunction_of_two_mul_log_card_lt {α : Type u_1} (C : ConceptClass α Bool) {m k : ℕ} (hm : 0 < m) {x : Fin m → α} {P : Finset (Fin m → Bool)} (hPC : ∀ u ∈ P, u ∈ restriction C x) {ε : ℝ} (hP : ∀ u ∈ P, ∀ v ∈ P, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) (hk : 2 * Real.log ↑P.card < ε * ↑k) :

Packing by the growth function. If the labelings in P ⊆ restriction C x pairwise differ on at least ε m of the m > 0 points x and 2 log |P| < ε k, then |P| ≤ Π_C(k).

theorem Cslib.MachineLearning.PACLearning.card_le_div_pow_of_forall_two_mul_log_card_lt {β : Type u_2} {m d : ℕ} {P : Finset (Fin m → β)} {ε K : ℝ} (hK : 1 ≤ K) (hε : 0 < ε) (hε1 : ε ≤ 1) (hsub : ∀ {r : ℕ} {T : ℝ}, 0 < m → 2 * Real.log ↑P.card < ε * ↑r → 1 ≤ T → ↑P.card ≤ Real.exp (↑r / T) * (T * K) ^ d) :
↑P.card ≤ (8 * K / ε) ^ (2 * d)

Subsampling-and-squaring packing step: if any r satisfying 2 log |P| < ε r (with 0 < m) bounds P.card by exp (r / T) · (T · K) ^ d for every T ≥ 1 (where K ≥ 1 and 0 < ε ≤ 1), then P.card ≤ (8 K / ε) ^ (2 d). Choosing K = 1 gives Dudley's binary VC bound; choosing K = max 1 (|β| choose 2) gives the multiclass Natarajan bound.

theorem Cslib.MachineLearning.PACLearning.card_le_div_pow_of_le_hammingDist {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} {x : Fin m → α} {P : Finset (Fin m → Bool)} (hPC : ∀ u ∈ P, u ∈ restriction C x) {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hP : ∀ u ∈ P, ∀ v ∈ P, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) :
↑P.card ≤ (8 / ε) ^ (2 * d)

Packing bound for VC classes [Vershynin2018, Theorem 8.3.18; Dudley1978]: if every set shattered by C has at most d points, a set of labelings realized by C on m points whose members pairwise differ on at least ε m points, 0 < ε ≤ 1, has at most (8 / ε) ^ (2 d) elements.

theorem Cslib.MachineLearning.PACLearning.exists_subset_separated_and_covering {β : Type u_2} [DecidableEq β] {m : ℕ} (L : Finset (Fin m → β)) {ε : ℝ} (hε : 0 ≤ ε) :
∃ N ⊆ L, (∀ u ∈ N, ∀ v ∈ N, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) ∧ ∀ u ∈ L, ∃ v ∈ N, ↑(hammingDist v u) ≤ ε * ↑m

Every finite set L : Finset (Fin m → β) contains an ε-separated subset N ⊆ L (0 ≤ ε) whose ε m-Hamming balls cover L.