Documentation

CslibFrontier.MachineLearning.PACLearning.SampleComplexityLower

Sample Complexity Lower Bound #

We use the prefix ehkv for Ehrenfeucht–Haussler–Kearns–Valiant throughout.

This module formalizes the main result of [EHKV89]: a lower bound on the number of examples required for PAC learning of a binary concept class, in terms of its Vapnik-Chervonenkis dimension.

The headline theorem is parameterized by an arbitrary distribution family 𝒟 : Set (Measure (α × Bool)). We require that 𝒟 contains all realizable distributions for C, i.e. pushforwards P.map (x ↦ (x, c x)) for any probability measure P : Measure α and concept c ∈ C. The agnostic case (𝒟 = Set.univ) and the (minimal) realizable case fall out as one-line corollaries.

The argument uses a marginal-sample-space EHKV witness lemma (in SampleComplexityLower.EHKVProof) and bridges to the joint-sample-space failure event of IsPACLearnerFor / IsRPACLearnerFor via the change-of-variables pi_map_sampleOf below.

Main statements #

References #

Bridge lemmas: joint sample space ↔ marginal sample space #

The pi-product of pushforwards along (x ↦ (x, decide (x ∈ c))) equals the pushforward of the pi-product along sampleOf c.

theorem Cslib.MachineLearning.PACLearning.error_realizable_self_eq_zero {α : Type u_1} [MeasurableSpace α] (P : MeasureTheory.Measure α) {c : α → Bool} (hc_meas : Measurable c) :
error (MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P) c = 0

The realizable joint distribution P.map (x ↦ (x, c x)) has zero error against c itself.

theorem Cslib.MachineLearning.PACLearning.optimalError_realizable_eq_zero {α : Type u_1} [MeasurableSpace α] (P : MeasureTheory.Measure α) {C : ConceptClass α Bool} {c : α → Bool} (hc : c ∈ C) (hc_meas : Measurable c) :
optimalError (MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P) C = 0

For a concept c ∈ C, the realizable distribution P.map (x ↦ (x, c x)) has optimalError = 0.

Bridge: finite-support equality of joint and marginal failure events #

Headline EHKV lower bound #

theorem Cslib.MachineLearning.PACLearning.sample_complexity_lower_bound_randomized {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {W : Finset α} {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hW : SetShatters C ↑W) (hW_card : 2 ≤ W.card) (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hC_meas : ∀ c ∈ C, Measurable c) {𝒟 : Set (MeasureTheory.Measure (α × Bool))} (h_real : ∀ (P : MeasureTheory.Measure α), MeasureTheory.IsProbabilityMeasure P → ∀ c ∈ C, MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P ∈ 𝒟) (hlearn : IsRPACLearnerFor m ε δ C 𝒟) :
(↑W.card - 1) / (32 * ↑↑ε) ≤ ↑m

Theorem 1 (randomized, family-parametric) [EHKV89]: The sample-complexity lower bound (|W| - 1) / (32 ε) ≤ m holds for randomized (ε, δ)-PAC learners over any distribution family 𝒟 containing all realizable distributions for C. [EHKV1989, §3, Theorem 1] states this for 0 < δ ≤ 1/100; the proof here allows the wider range δ < 1/14.

theorem Cslib.MachineLearning.PACLearning.sample_complexity_lower_bound {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {W : Finset α} {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hW : SetShatters C ↑W) (hW_card : 2 ≤ W.card) (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hC_meas : ∀ c ∈ C, Measurable c) {𝒟 : Set (MeasureTheory.Measure (α × Bool))} (h_real : ∀ (P : MeasureTheory.Measure α), MeasureTheory.IsProbabilityMeasure P → ∀ c ∈ C, MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P ∈ 𝒟) (hlearn : IsPACLearnerFor m ε δ C 𝒟) :
(↑W.card - 1) / (32 * ↑↑ε) ≤ ↑m

Deterministic specialization via IsPACLearnerFor.toIsRPACLearnerFor.

theorem Cslib.MachineLearning.PACLearning.sample_complexity_lower_bound_agnostic_randomized {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {W : Finset α} {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hW : SetShatters C ↑W) (hW_card : 2 ≤ W.card) (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hC_meas : ∀ c ∈ C, Measurable c) (hlearn : IsRPACLearnerFor m ε δ C Set.univ) :
(↑W.card - 1) / (32 * ↑↑ε) ≤ ↑m

Agnostic specialization (𝒟 = Set.univ): the realizable distributions are trivially included.

Loose: this is the realizable bound applied to the agnostic case; the tight agnostic rate is Ω(d/ε²) (see TODO at the bottom of this file).

theorem Cslib.MachineLearning.PACLearning.sample_complexity_lower_bound_agnostic {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {W : Finset α} {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hW : SetShatters C ↑W) (hW_card : 2 ≤ W.card) (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hC_meas : ∀ c ∈ C, Measurable c) (hlearn : IsPACLearnerFor m ε δ C Set.univ) :
(↑W.card - 1) / (32 * ↑↑ε) ≤ ↑m

Deterministic agnostic specialization.

theorem Cslib.MachineLearning.PACLearning.sample_complexity_lower_bound_vcDim {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hvc : 2 ≤ vcDim C) (hbdd : HasFiniteVCDim C) (hC_meas : ∀ c ∈ C, Measurable c) {𝒟 : Set (MeasureTheory.Measure (α × Bool))} (h_real : ∀ (P : MeasureTheory.Measure α), MeasureTheory.IsProbabilityMeasure P → ∀ c ∈ C, MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P ∈ 𝒟) (hlearn : IsRPACLearnerFor m ε δ C 𝒟) :
(↑(vcDim C) - 1) / (32 * ↑↑ε) ≤ ↑m

Corollary: the EHKV lower bound stated in terms of vcDim.

The HasFiniteVCDim C hypothesis is what makes vcDim C mathematically meaningful: it guarantees the indexing set of shattered cardinalities is bounded, so sSup returns the actual maximum rather than 0 (its default on unbounded ℕ-sets). See hasFiniteVCDim_iff for the more intuitive "exists a uniform bound on shattered cardinalities" reformulation.

theorem Cslib.MachineLearning.PACLearning.sampleComplexity_lower_bound_vcDim {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {ε δ : ↑(Set.Ioo 0 1)} (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hvc : 2 ≤ vcDim C) (hbdd : HasFiniteVCDim C) (hC_meas : ∀ c ∈ C, Measurable c) {𝒟 : Set (MeasureTheory.Measure (α × Bool))} (h_real : ∀ (P : MeasureTheory.Measure α), MeasureTheory.IsProbabilityMeasure P → ∀ c ∈ C, MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P ∈ 𝒟) (hlearnable : {n : ℕ | IsPACLearnerFor n ε δ C 𝒟}.Nonempty) :
(↑(vcDim C) - 1) / (32 * ↑↑ε) ≤ ↑(sampleComplexity IsPACLearnerFor C ε δ 𝒟)

Lower bound on deterministic sample complexity in terms of vcDim.

theorem Cslib.MachineLearning.PACLearning.rsampleComplexity_lower_bound_vcDim {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] {C : ConceptClass α Bool} {ε δ : ↑(Set.Ioo 0 1)} (hε_le : ↑↑ε ≤ 1 / 8) (hδ_lt : ↑↑δ < 1 / 14) (hvc : 2 ≤ vcDim C) (hbdd : HasFiniteVCDim C) (hC_meas : ∀ c ∈ C, Measurable c) {𝒟 : Set (MeasureTheory.Measure (α × Bool))} (h_real : ∀ (P : MeasureTheory.Measure α), MeasureTheory.IsProbabilityMeasure P → ∀ c ∈ C, MeasureTheory.Measure.map (fun (x : α) => (x, c x)) P ∈ 𝒟) (hlearnable : {n : ℕ | IsRPACLearnerFor n ε δ C 𝒟}.Nonempty) :
(↑(vcDim C) - 1) / (32 * ↑↑ε) ≤ ↑(rsampleComplexity C ε δ 𝒟)

Lower bound on randomized sample complexity in terms of vcDim.