Documentation

CslibFrontier.MachineLearning.PACLearning.HausslerPacking

Haussler's Sphere-Packing Lemma for VC Classes #

Subsampling alone bounds an ε-separated set of labelings of VC dimension d by Dudley's O((1 / ε) ^ (2 d)) (card_le_div_pow_of_le_hammingDist in CslibFrontier/MachineLearning/PACLearning/Packing.lean), losing a factor of 2 in the exponent. Haussler [Hau95] sharpened the exponent to the optimal d, proving that every ε-separated subset P ⊆ {0, 1}^m whose shattered sets have size at most d satisfies

|P| ≤ e (d + 1) (2 e / ε) ^ d.

This module formalizes Haussler's sphere-packing bound and its Hamming covering-net corollary:

  1. Weighted one-inclusion shifting inequality (sum_min_update_le_mul_sum): a weighted coordinate-shifting strengthening of the hypercube edge-density bound in [Hau95]. For any nonnegative weight μ : (ι → Bool) → ℝ whose positive support shatters no finite set of more than d coordinates, the sum of min (μ f) (μ (update f i true)) over all hypercube edges is at most d · ∑ f, μ f. Coordinate shifting replaces μ on Fin (n + 1) → Bool by pointwise max and min across coordinate 0, whose supports shatter at most d and d - 1 coordinates respectively.
  2. Harmonic-mean edge bound (sum_harmonic_update_le_two_mul_sum): since 2 a b / (a + b) ≤ 2 min a b for a, b ≥ 0, the harmonic-mean edge sum is at most 2 d · ∑ f, μ f, obtained directly from the weighted shifting step without an edge-orientation argument.
  3. Random-projection fiber gap (mul_sub_expect_card_image_le): applying the harmonic-mean bound to fiber multiplicities of P on uniform (r + 1)-tuples t : Fin (r + 1) → Fin m (sampled with replacement, so the argument allows r = ⌊2 (d + 1) / ε⌋₊ even when r ≥ m) and counting within-fiber disagreements across the (r + 1)-st coordinate yields ((r + 1) ε - 2 d) |P| ≤ (r + 1) ε · 𝔼_s [|P|_s|].
  4. Haussler's Boolean n-cube sphere-packing theorem (card_le_exp_mul_add_one_mul_pow_of_setShatters, card_le_exp_mul_add_one_mul_pow, [Hau95]): choosing r = ⌊2 (d + 1) / ε⌋₊ and bounding |P|_s| by growthFunction_le_exp_mul_pow at T = 2 / ε gives |P| ≤ e (d + 1) (2 e / ε) ^ d for 0 < ε ≤ 1, along with the vcDim form and the maximal-packing covering-net bound (exists_covering_haussler). The 1995 J. Combin. Theory Ser. A PDF has not been inspected firsthand here, so internal lemma/theorem numbers are omitted; the general L¹(P) probability- measure extension remains open under #4920.

Main definitions #

Main results #

References #

1. Weighted hypercube min-edge shifting inequality #

noncomputable def Cslib.MachineLearning.PACLearning.hypercubeEdgeMinSum {ι : Type u_2} [DecidableEq ι] [Fintype ι] (μ : (ι → Bool) → ℝ) :

Sum of min (μ f) (μ (Function.update f i true)) across all undirected hypercube edges (i, f) with f i = false (weighted analogue of the hypercube edge count in [Hau95]).

theorem Cslib.MachineLearning.PACLearning.hypercubeEdgeMinSum_eq_sum {ι : Type u_2} [DecidableEq ι] [Fintype ι] (μ : (ι → Bool) → ℝ) :
hypercubeEdgeMinSum μ = ∑ i : ι, ∑ f : ι → Bool, if f i = false then min (μ f) (μ (Function.update f i true)) else 0

The edge-minimum sum counts each edge at its endpoint with coordinate i equal to false.

theorem Cslib.MachineLearning.PACLearning.sum_min_update_le_mul_sum {ι : Type u_2} [DecidableEq ι] [Fintype ι] {d : ℕ} {μ : (ι → Bool) → ℝ} (hμ : ∀ (f : ι → Bool), 0 ≤ μ f) (hsh : ∀ (W : Finset ι), SetShatters {f : ι → Bool | 0 < μ f} ↑W → W.card ≤ d) :
hypercubeEdgeMinSum μ ≤ ↑d * ∑ f : ι → Bool, μ f

Weighted hypercube edge-density inequality (a weighted coordinate-shifting strengthening of the edge-density lemma in [Hau95]): if μ : (ι → Bool) → ℝ is nonnegative and its support {f | 0 < μ f} shatters no finite set of more than d coordinates, then hypercubeEdgeMinSum μ ≤ d * ∑ f, μ f.

theorem Cslib.MachineLearning.PACLearning.sum_harmonic_update_le_two_mul_sum {ι : Type u_2} [DecidableEq ι] [Fintype ι] {d : ℕ} {μ : (ι → Bool) → ℝ} (hμ : ∀ (f : ι → Bool), 0 ≤ μ f) (hsh : ∀ (W : Finset ι), SetShatters {f : ι → Bool | 0 < μ f} ↑W → W.card ≤ d) :
(∑ i : ι, ∑ f : ι → Bool, if f i = false then 2 * μ f * μ (Function.update f i true) / (μ f + μ (Function.update f i true)) else 0) ≤ 2 * ↑d * ∑ f : ι → Bool, μ f

Harmonic-mean hypercube edge inequality: under the hypotheses of sum_min_update_le_mul_sum, ∑ i, ∑ f, (if f i = false then 2 μ(f) μ(f⊕e_i) / (μ(f) + μ(f⊕e_i)) else 0) ≤ 2 d ∑ f, μ(f).

2. Random-projection fiber gap and Haussler's sphere-packing bound #

theorem Cslib.MachineLearning.PACLearning.mul_sub_expect_card_image_le {m d : ℕ} (hm : 0 < m) {P : Finset (Fin m → Bool)} (hsh : ∀ (W : Finset (Fin m)), SetShatters ↑P ↑W → W.card ≤ d) {ε : ℝ} (hP : ∀ u ∈ P, ∀ v ∈ P, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) (r : ℕ) :
((↑r + 1) * ε - 2 * ↑d) * ↑P.card ≤ (↑r + 1) * ε * ((∑ s : Fin r → Fin m, ↑(Finset.image (fun (u : Fin m → Bool) => u ∘ s) P).card) / ↑m ^ r)

Random-projection fiber gap [Hau95]: for an ε-separated subset P of {0, 1}^m (0 < m) whose shattered sets have size at most d, and any r : ℕ, ((r + 1) ε - 2 d) |P| ≤ (r + 1) ε · (∑ s : Fin r → Fin m, |P|_s|) / m ^ r.

theorem Cslib.MachineLearning.PACLearning.card_le_exp_mul_add_one_mul_pow_of_setShatters {m d : ℕ} {P : Finset (Fin m → Bool)} (hsh : ∀ (W : Finset (Fin m)), SetShatters ↑P ↑W → W.card ≤ d) {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hP : ∀ u ∈ P, ∀ v ∈ P, u ≠ v → ε * ↑m ≤ ↑(hammingDist u v)) :
↑P.card ≤ Real.exp 1 * (↑d + 1) * (2 * Real.exp 1 / ε) ^ d

Haussler's Sphere-Packing Theorem for a Boolean subset [Hau95]: if P : Finset (Fin m → Bool) shatters no finite set of more than d coordinates and its members pairwise have Hamming distance at least ε m (0 < ε ≤ 1), then P.card ≤ e (d + 1) (2 e / ε) ^ d.

theorem Cslib.MachineLearning.PACLearning.card_le_exp_mul_add_one_mul_pow {α : 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 ≤ Real.exp 1 * (↑d + 1) * (2 * Real.exp 1 / ε) ^ d

Haussler's Sphere-Packing Theorem for concept classes on a sample [Hau95]: if every finite set shattered by C : ConceptClass α Bool has at most d points, then any ε-separated set P ⊆ restriction C x of labelings on m sample points (0 < ε ≤ 1) has at most e (d + 1) (2 e / ε) ^ d elements, sharpening Dudley's (8 / ε) ^ (2 d) bound in card_le_div_pow_of_le_hammingDist.

theorem Cslib.MachineLearning.PACLearning.card_le_exp_mul_vcDim_add_one_mul_pow {α : Type u_1} {C : ConceptClass α Bool} (hC : HasFiniteVCDim C) {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 ≤ Real.exp 1 * (↑(vcDim C) + 1) * (2 * Real.exp 1 / ε) ^ vcDim C

Haussler's packing bound stated in terms of vcDim for a class of finite VC dimension.

theorem Cslib.MachineLearning.PACLearning.exists_covering_haussler {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} (x : Fin m → α) {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) :
∃ (N : Finset (Fin m → Bool)), (∀ u ∈ N, u ∈ restriction C x) ∧ ↑N.card ≤ Real.exp 1 * (↑d + 1) * (2 * Real.exp 1 / ε) ^ d ∧ ∀ u ∈ restriction C x, ∃ v ∈ N, ↑(hammingDist v u) ≤ ε * ↑m

Haussler Hamming covering-number bound: if every finite set shattered by C has size at most d, then for any m sample points x and 0 < ε ≤ 1, restriction C x admits an ε m-Hamming net N ⊆ restriction C x of size at most e (d + 1) (2 e / ε) ^ d.