Repository navigation
feat(MachineLearning): online-to-batch conversion of mistake bounds into PAC learners - #4932
Conversation
A deterministic online learner with mistake bound M on a class C gives a PAC learner over the distributions realizable by C. The prefix hypotheses after 0, ..., m of m i.i.d. examples have expected errors summing to at most M (Littlestone 1989; Cesa-Bianchi, Conconi and Gentile 2004); their majority vote, with Markov's inequality, is an (eps, delta)-PAC learner when 2M <= eps delta (m + 1). Measurability of the learner is a hypothesis, and holds on countable domains with measurable singletons. Part of #4918.
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Reviewer review-c (Jetski swarm, coordinator session 5f40c2da; non-author agent review, not human review) at f9d79f9: APPROVE
What is proved. For a deterministic OnlineLearner A that is jointly measurable in (history, instance) for each history length, and D realizable by C:
lintegral_error_prefixHypothesis_eq:𝔼_{S∼D^m} error D (A after t examples) = D^{m+1}{A errs on example t}. This is the key step:Fin.removeNth tdoes not change the length-tprefix (prefixHypothesis_removeNth), someasurePreserving_piFinSuccAboveplusMeasure.prod_apply_symmgives exactly this.sum_lintegral_error_prefixHypothesis_le: the sum overt ≤ mis the expected number of mistakes onm + 1examples, at mostMa.s. viaIsRealizableBy.ae_realizableandmistakes_le_mistakeBound. This givesM/(m+1)for a uniformly random prefix hypothesis, the issue's bound in sum form.- Majority vote: where
prefixMajorityerrs, at least(m+1)/2prefix hypotheses err (I checked both labels against thedecide (m + 1 < 2 * #true)tie rule), so(m+1)·error ≤ 2·Σ errorpointwise, then Markov givesIsPACLearnerFor m ε δ C (realizableDistributions C)when2M ≤ εδ(m+1). - Edge cases:
M = 0givesm = 0, and the bound reduces toerror ≤ 0for the empty-history hypothesis, which holds because a learner with mistake bound 0 is never wrong on any realizable point.not_isPACLearnerFor_three_zeroshows that the 7-sample instance is not vacuous. The testoptimalMistakeBound thresholdClass = ⊤correctly marks where the theorem stops.
The model limits are stated accurately: the confidence dependence is 1/δ, not log(1/δ); the factor 2 comes from derandomization; IsMeasurableLearner is needed only off countable domains; no running time is claimed.
Source mapping (nit, non-blocking). The module docstring (lines 25–27), the sum_lintegral_error_prefixHypothesis_le docstring (245–249) and the manual call the random-prefix M/(m+1) statement "the online-to-batch conversion of [Littlestone1989] and [CesaBianchiConconiGentile2004]". As far as I know, Littlestone 1989's conversion is the hypothesis-testing scheme: keep the hypotheses, validate them on held-out data, get log(1/δ). The PR body correctly says that scheme is not formalized. The expectation identity "average risk of H_0..H_{n-1} has expectation 𝔼 M_n / n" is what CBCG 2004 (§II) uses. I suggest crediting the random-stopping expectation bound to CBCG 2004 and citing Littlestone 1989 as the origin of online-to-batch conversion and of the high-confidence version not formalized here. The locators are already labelled unverified, so this does not block.
Imports (nit). OnlineToBatch.lean:11: the public statements need only IsRealizableBy and realizableDistributions from PACLearning.Realizable. RealizableSample (ae_realizable) is used only in proofs, so public import ...PACLearning.Realizable plus plain import ...PACLearning.RealizableSample keeps the exported surface minimal.
Small proof duplication (nits).
measurableSet_prefix_ne(131–136) restatesmeasurableSet_misclassified(139–146) pulled back alongS ↦ (S, S i). It could be a one-linepreimageof the latter, which is the same movehFmakes at line 202.isPACLearnerFor_prefixMajorityre-deriveshint(357–360), the last two steps oflintegral_error_prefixMajority_le's calc. A privatelintegral_two_mul_sum_error_prefix_le(≤ 2 * M), used by both, would remove the repetition.
Reuse/placement. No parallel notion found. IsMeasurableLearner is new; the library has only hypothesis-level measurableSet_misclassified in RealizableSample, which this PR's private lemma of the same name does not shadow (it is private and namespaced). mistakes_eq_card, realizable_iff, mistakes_le_mistakeBound, ae_realizable and optimalError_eq_zero are reused. The placement under OnlineLearning/MistakeBound/ fits, since the module is about OnlineLearner/mistakeBound. @[expose] on the three definitions is justified: the decide tests unfold prefixHypothesis/prefixMajority, and clients off countable domains must unfold IsMeasurableLearner. Style is clean: simp only mid-proof, terminal simp_all <;> omega, header/marker/authors correct, bib entries in key order with correct venue/volume/pages/DOI.
Manuals. The Operator's Manual paragraph is in topic order (after WINNOW1, before randomized learners), names the API and the limits correctly, and links the module and tests. The cross-reference from the realizable-PAC section points to the right anchor. I agree that the Agent Operator's Manual needs no change (no workflow or tooling change). ROADMAP is left to the coordinator because this is a milestone of #4918; Part B remains.
CI. ci-checks, build and guide pass at f9d79f9. The Parallel-definition notice (3 definitions examined), the Duplicate-statement notice (18 theorems) and the Repeated-proof-block notice (18 proofs) are all empty, and my own source search agrees.
The nits above are optional follow-ups. Approving and queueing this head.
|
Agent review (Jetski reviewer jrev-4932, coordinated by jetski-coord-8077 / #4809), head f9d79f9: APPROVE The statements faithfully express the realizable online-to-batch conversion. The hypotheses are not vacuous. I found no duplication with this repository, CSLib, Mathlib or #4933: the PR reuses the shared Non-blocking:
This is agent review, not human review. |
Mistake bound ⇒ realizable PAC learning by online-to-batch conversion: the first milestone (Part A) of #4918.
Mathematical result. A deterministic
OnlineLearnerAwithmistakeBound A C ≤ Mgives a PAC learner overrealizableDistributions C. LetprefixHypothesis A S tbeA's hypothesis after the firsttexamples. On i.i.d. examples its expected error equals the probability thatAerrs on the fresh exampletof an(m + 1)-sample (lintegral_error_prefixHypothesis_eq, viameasurePreserving_piFinSuccAboveand Fubini). Summing overt ≤ mbounds the expected errors of them + 1prefix hypotheses byM(sum_lintegral_error_prefixHypothesis_le). This is the random-stopping conversion of Littlestone (COLT 1989) and Cesa-Bianchi–Conconi–Gentile (IEEE TIT 2004): a uniformly random prefix hypothesis has expected error≤ M/(m+1). UpstreamIsPACLearnerForneeds a deterministic learner, so the module derandomizes with the majority voteprefixMajority A, whose expected error is≤ 2M/(m+1)(lintegral_error_prefixMajority_le). Markov then givesIsPACLearnerFor m ε δ C (realizableDistributions C)whenever2M ≤ εδ(m+1)(isPACLearnerFor_prefixMajority), andIsPACLearnablewith sample size⌈2M/(εδ)⌉(isPACLearnable_of_mistakeBound_le). On countable domains with measurable singletons, a finiteoptimalMistakeBound(equivalently finite Littlestone dimension) implies PAC learnability (isPACLearnable_of_optimalMistakeBound_ne_top).Model and limitations.
IsMeasurableLearner). This holds automatically on countable domains with measurable singletons (isMeasurableLearner_of_countable).1/δ(Markov), not thelog(1/δ)of Littlestone's hypothesis-testing conversion, which is not formalized.M/(m+1)bound on the average over prefixes is the sources' statement. The majority vote and its factor 2 are this library's derandomization. Theorem numbers and locators are unverified and marked so.compression). It is not duplicated here.Infrastructure: two
references.bibentries (Littlestone1989,CesaBianchiConconiGentile2004).Tests (
CslibFrontierTests/OnlineToBatch.lean):(1/2, 1/2)-PAC learner for three concepts onFin 2, and a proof that 0 examples do not suffice.θ ≤ 7on ℕ via SOA and viaoptimalMistakeBound.optimalMistakeBound thresholdClass = ⊤: the theorem does not cover all thresholds, although VC theory does.Manual impact
Validation
lake build --wfail --iofailof the new module and test file: clean (no warnings).scripts/check_hygiene.py: passed.Part of #4918.
AI disclosure: implemented by a Jetski AI agent as worker
sgdunder coordinator session 5f40c2da, for Samuel Schlesinger. Review is by agentreview-c, which is agent review, not human review.