Documentation

CslibFrontier.MachineLearning.PACLearning.NatarajanAgnostic

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

This module proves the countable-domain agnostic upper-bound step toward the multiclass fundamental theorem [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084). If a multiclass concept class C on a countable domain α with k labels N-shatters no finite set of more than d points, then its Boolean loss class lossClass C on α × β shatters no finite set of more than 6 d (log k + 1) labeled points (card_le_of_setShatters_lossClass_of_natarajan): a shattered set of n labeled points realizes 2 ^ n loss patterns, while Natarajan's lemma bounds them by k ^ (2 d) exp (n / 3) 3 ^ d.

Feeding this VC bound for lossClass C into the chaining-based uniform-convergence theorem of AgnosticVCSharp.lean [Vershynin2018, Section 8.3] yields uniform convergence without a log (1 / ε) factor, empirical-risk-minimization learning from

natarajanAgnosticSampleSize d k (ε / 2) δ = (393216 d (log k + 1) + 128 log (4 / δ)) / ε²

examples (rate O((d (log k + 1) + log (1 / δ)) / ε²), matching the O((d log k + log (1 / δ)) / ε²) rate of Theorem 29.3 once k ≥ 2), the uniform convergence property, and agnostic PAC learnability for every class of finite Natarajan dimension on a countable domain with finitely many labels.

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

Main definitions #

Main results #

References #

theorem Cslib.MachineLearning.PACLearning.card_le_of_setShatters_lossClass_of_natarajan {α : Type u_1} {β : Type u_2} [Fintype β] [DecidableEq β] [Nonempty β] {C : ConceptClass α β} {d : ℕ} (hC : ∀ (W : Finset α), NatarajanShatters C ↑W → W.card ≤ d) {W : Finset (α × β)} (hW : SetShatters (lossClass C) ↑W) :
↑W.card ≤ 6 * ↑d * (Real.log ↑(Fintype.card β) + 1)

Shattering bound for the multiclass loss class: if C N-shatters no finite set of more than d points and has k ≥ 1 labels, then its Boolean loss class shatters no finite set of more than 6 d (log k + 1) labeled points.

The chaining sample size (98304 d (log k + 1) + 32 log (4 / δ)) / ε² for ε-representative multiclass samples (98304 = 16384 · 6).

theorem Cslib.MachineLearning.PACLearning.measure_pi_not_isRepresentative_le_exp_of_natarajan {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] [MeasurableSpace β] [MeasurableSingletonClass β] [Fintype β] [DecidableEq β] (D : MeasureTheory.Measure (α × β)) [MeasureTheory.IsProbabilityMeasure D] {C : ConceptClass α β} {d : ℕ} (hC : ∀ (W : Finset α), NatarajanShatters C ↑W → W.card ≤ d) {m : ℕ} {ε : ℝ} (hε : 0 ≤ ε) (hm : 98304 * ↑d * (Real.log ↑(Fintype.card β) + 1) ≤ ↑m * ε ^ 2) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × β | ¬IsRepresentative D C ε S} ≤ ENNReal.ofReal (4 * Real.exp (-(↑m * ε ^ 2 / 32)))

Countable-domain multiclass uniform convergence without a log (1 / ε) factor (step toward [ShalevShwartzBenDavid2014, Theorem 29.3], #5084): if every finite set N-shattered by C has at most d points and 98304 d (log k + 1) ≤ m ε², then m i.i.d. examples fail to be ε-representative for C with probability at most 4 exp (-m ε² / 32).

Countable-domain multiclass uniform convergence at natarajanAgnosticSampleSize (step toward [ShalevShwartzBenDavid2014, Theorem 29.3], #5084): if every finite set N-shattered by C has at most d points and m ≥ natarajanAgnosticSampleSize d k ε δ, then m i.i.d. examples fail to be ε-representative for C with probability at most δ.

theorem Cslib.MachineLearning.PACLearning.IsERM.measure_pi_lt_error_le_exp_of_natarajan {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] [MeasurableSpace β] [MeasurableSingletonClass β] [Fintype β] [DecidableEq β] (D : MeasureTheory.Measure (α × β)) [MeasureTheory.IsProbabilityMeasure D] {C : ConceptClass α β} {d : ℕ} (hC : ∀ (W : Finset α), NatarajanShatters C ↑W → W.card ≤ d) {m : ℕ} {A : Learner α β m} (hA : IsERM A C) {ε : ℝ} (hε : 0 ≤ ε) (hm : 393216 * ↑d * (Real.log ↑(Fintype.card β) + 1) ≤ ↑m * ε ^ 2) :
(MeasureTheory.Measure.pi fun (x : Fin m) => D) {S : Fin m → α × β | optimalError D C + ENNReal.ofReal ε < error D (A S)} ≤ ENNReal.ofReal (4 * Real.exp (-(↑m * ε ^ 2 / 128)))

Countable-domain agnostic ERM exponential tail bound (step toward [ShalevShwartzBenDavid2014, Theorem 29.3], #5084): if every finite set N-shattered by C has at most d points and 393216 d (log k + 1) ≤ m ε², then under every distribution an empirical risk minimizer for C misses optimalError D C + ε with probability at most 4 exp (-m ε² / 128).

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

Countable-domain agnostic ERM sample-size bound (step toward [ShalevShwartzBenDavid2014, Theorem 29.3], #5084): if every finite set N-shattered by C has at most d points and m ≥ natarajanAgnosticSampleSize d k (ε / 2) δ = (393216 d (log k + 1) + 128 log (4 / δ)) / ε², then under every distribution an empirical risk minimizer for C misses optimalError D C + ε with probability at most δ.

theorem Cslib.MachineLearning.PACLearning.isPACLearnerFor_univ_of_natarajanAgnosticSampleSize_le {α : Type u_1} {β : Type u_2} [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] [MeasurableSpace β] [MeasurableSingletonClass β] [Fintype β] [Nonempty β] {C : ConceptClass α β} {d : ℕ} (hC : ∀ (W : Finset α), NatarajanShatters C ↑W → W.card ≤ d) {m : ℕ} {ε δ : ↑(Set.Ioo 0 1)} (hm : natarajanAgnosticSampleSize d (Fintype.card β) (↑↑ε / 2) ↑↑δ ≤ ↑m) :

Countable-domain agnostic PAC learner step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): a class whose N-shattered finite sets have at most d points is agnostically (ε, δ)-PAC learnable from m ≥ natarajanAgnosticSampleSize d k (ε / 2) δ examples, which is O((d (log k + 1) + log (1 / δ)) / ε²).

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

Countable-domain uniform-convergence step toward [ShalevShwartzBenDavid2014, Theorem 29.3] (#5084): every class of finite Natarajan dimension on a countable domain with finitely many labels has the uniform convergence property over all distributions.

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