Documentation

CslibFrontier.MachineLearning.PACLearning.NatarajanUpperBound

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

This module proves the countable-domain realizable upper-bound step toward the multiclass fundamental theorem [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084). Let C be a concept class on a countable domain α with labels in a finite type β of size k, all of whose N-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 / ε) + 2 d log k + log (4 / δ))

examples. Consequently every class of finite Natarajan dimension with finitely many labels on a countable domain is PAC learnable in the realizable setting, with realizable sample complexity O((d log (k / ε) + log (1 / δ)) / ε).

The proof reuses the binary ε-net machinery (EpsilonNet.lean and VCUpperBound.lean) on the Boolean loss class {(x, y) ↦ [h x ≠ y] | h ∈ C}. The misclassification pattern on labeled points is determined by the labeling of their domain points, so Natarajan's lemma bounds the growth function of the loss class by natarajanSum m k d ≤ k ^ (2 d) exp (m / T) T ^ d. Running the binary sample-size bound (le_of_vcSampleSize_le) at confidence δ / k ^ (2 d) absorbs the factor k ^ (2 d).

The domain is assumed countable with measurable singletons and the labels finite with measurable singletons, so every set of samples is measurable; learners are arbitrary semantic maps without running-time claims. General measurable domains (#2868) and the sample-complexity lower bounds of Theorem 29.3 remain open in #5084; the agnostic countable-domain upper bound is in NatarajanAgnostic.lean.

Main definitions #

Main results #

References #

theorem Cslib.MachineLearning.PACLearning.growthFunction_lossClass_le_natarajanSum {α : Type u_1} {β : Type u_2} [Fintype β] [DecidableEq β] {C : ConceptClass α β} {d : ℕ} (hC : ∀ (W : Finset α), NatarajanShatters C ↑W → W.card ≤ d) (m : ℕ) :

Natarajan's lemma for the loss class: if C N-shatters no finite set of more than d points, its Boolean loss class has growth function at most ∑_{i ≤ d} (m choose i) (k choose 2)^i. The misclassification pattern on labeled points is determined by the labeling of their domain points.

theorem Cslib.MachineLearning.PACLearning.natarajanSum_le_pow_mul_exp_mul_pow (n d : ℕ) {k : ℕ} (hk : 0 < k) {T : ℝ} (hT : 1 ≤ T) :
↑(natarajanSum n k d) ≤ ↑k ^ (2 * d) * (Real.exp (↑n / T) * T ^ d)

Real-exponential form of Natarajan's lemma for sample-size bounds: with at least one label, ∑_{i ≤ d} (n choose i) (k choose 2) ^ i ≤ k ^ (2 d) exp (n / T) T ^ d for every T ≥ 1.

The realizable multiclass sample size (8 / ε) (d log (48 / ε) + 2 d log k + log (4 / δ)) for k labels. It equals vcSampleSize d ε (δ / k ^ (2 d)) (natarajanSampleSize_eq_vcSampleSize).

theorem Cslib.MachineLearning.PACLearning.natarajanSampleSize_eq_vcSampleSize (d : ℕ) {k : ℕ} (hk : 0 < k) (ε : ℝ) {δ : ℝ} (hδ : 0 < δ) :
natarajanSampleSize d k ε δ = vcSampleSize d ε (δ / ↑k ^ (2 * d))

The realizable multiclass sample size is the binary VC sample size at confidence δ / k ^ (2 d).

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

Countable-domain realizable upper-bound step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): if every finite set N-shattered by C has at most d points, D is realizable by C, A is consistent with C, and m ≥ (8 / ε) (d log (48 / ε) + 2 d log k + log (4 / δ)) with k labels, then A on m i.i.d. examples has error greater than ε with probability at most δ.

Countable-domain realizable PAC learner step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): a class whose N-shattered finite sets have at most d points is (ε, δ)-PAC learnable over the distributions it realizes from m ≥ natarajanSampleSize d k ε δ examples.

Countable-domain realizable sample-complexity step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): a class of finite Natarajan dimension d with k labels has realizable sample complexity at most ⌈(8 / ε) (d log (48 / ε) + 2 d log k + log (4 / δ))⌉.

Countable-domain realizable learnability step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): every class of finite Natarajan dimension on a countable domain with finitely many labels is PAC learnable over the distributions it realizes.