Documentation

CslibFrontier.MachineLearning.PACLearning.VCUpperBound

The VC upper bound for realizable PAC learning on countable domains #

Let C be a binary concept class on a countable domain α all of whose shattered finite sets have at most d points. Then every consistent learner (in particular every empirical risk minimizer) learns C to accuracy ε with confidence 1 - δ over every distribution realizable by C from

m ≥ (8 / ε) (d log (48 / ε) + log (4 / δ))

examples [BlumerEhrenfeuchtHausslerWarmuth1989, Theorem 2.1; ShalevShwartzBenDavid2014, Section 28.3]. Hence every class of finite VC dimension on a countable domain is PAC learnable in the realizable setting, with realizable sample complexity O((d log (1 / ε) + log (1 / δ)) / ε). The constants differ from those of the cited sources but have the same form.

The proof applies the ε-net theorem (EpsilonNet.lean) to the loss class {(x, y) ↦ [h x ≠ y] | h ∈ C} and the example distribution D. Its growth function is at most that of C. On a realizable sample a consistent learner almost surely outputs some h ∈ C agreeing with every example, so if error D h > ε the sample is not an ε-net for the loss class.

The domain is assumed countable with measurable singletons and the labels are Bool; the learners are arbitrary semantic maps from samples to hypotheses, and no running time is claimed. General domains need a measurability hypothesis on the class and are not formalized here. The matching Ω(d / ε) lower bound of Ehrenfeucht, Haussler, Kearns and Valiant is in VCLowerBound, and FundamentalTheorem combines the two into the realizable characterization of learnability.

Main definitions #

Main results #

References #

The loss class of a concept class C with decidable label equality: for each h ∈ C, the indicator of the labeled examples (x, y) that h misclassifies.

theorem Cslib.MachineLearning.PACLearning.mem_lossClass {α : Type u_1} {β : Type u_2} [DecidableEq β] {C : ConceptClass α β} {f : α × β → Bool} :
f ∈ lossClass C ↔ ∃ h ∈ C, (fun (p : α × β) => decide (h p.1 ≠ p.2)) = f

Passing to the loss class does not increase the growth function: the misclassification pattern on labeled points is determined by the labeling of their domain points.

theorem Cslib.MachineLearning.PACLearning.card_le_of_setShatters_lossClass {α : Type u_1} {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (W : Finset (α × Bool)) (hW : SetShatters (lossClass C) ↑W) :
W.card ≤ d

The loss class shatters no larger finite sets than C: two labeled points of a set shattered by lossClass C have distinct domain points, and their domain points are shattered by C.

Under a distribution realizable by C, a consistent learner whose output has error greater than ε almost surely witnesses that the sample is not an ε-net for the loss class of C.

VC tail bound for consistent learners on a countable domain: under a distribution realizable by C, if 8 ≤ εm then a consistent learner's output has error greater than ε with probability at most 2 Π_C(2m) / 2 ^ ⌈εm/2⌉.

theorem Cslib.MachineLearning.PACLearning.IsConsistent.measure_pi_lt_error_le_of_vcSampleSize_le {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} {A : Learner α Bool m} (hA : IsConsistent A C) {D : MeasureTheory.Measure (α × Bool)} [MeasureTheory.IsProbabilityMeasure D] (hD : IsRealizableBy D C) {ε δ : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) (hδ : 0 < δ) (hδ1 : δ ≤ 1) (hm : vcSampleSize d ε δ ≤ ↑m) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × Bool | ENNReal.ofReal ε < error D (A S)} ≤ ENNReal.ofReal δ

The VC upper bound for consistent learners on a countable domain [BlumerEhrenfeuchtHausslerWarmuth1989, Theorem 2.1; ShalevShwartzBenDavid2014, Section 28.3]: if every finite set shattered by C has at most d points, D is realizable by C, A is consistent with C, and m ≥ (8 / ε) (d log (48 / ε) + log (4 / δ)), then the output of A on m i.i.d. examples has error greater than ε with probability at most δ.

theorem Cslib.MachineLearning.PACLearning.isPACLearnerFor_realizableDistributions_of_vcSampleSize_le {α : Type u_1} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] {C : ConceptClass α Bool} {d : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hm : vcSampleSize d ↑↑ε ↑↑δ ≤ ↑m) :

The VC upper bound for realizable PAC learning on a countable domain [BlumerEhrenfeuchtHausslerWarmuth1989, Theorem 2.1]: a class whose shattered finite sets have at most d points is (ε, δ)-PAC learnable over the distributions it realizes from m ≥ (8 / ε) (d log (48 / ε) + log (4 / δ)) examples, by any consistent learner (by any learner at all if the class is empty, since then no distribution is realizable).

The realizable sample complexity of a class of finite VC dimension on a countable domain is at most ⌈(8 / ε) (vcDim C log (48 / ε) + log (4 / δ))⌉.

Finite VC dimension implies realizable PAC learnability on a countable domain [BlumerEhrenfeuchtHausslerWarmuth1989, Theorem 2.1].