Repository navigation
feat(MachineLearning): AdaBoost and its training-error bound - #4948
SamuelSchlesinger wants to merge 4 commits into
Conversation
AdaBoost on a finite labelled sample with a deterministic weak learner, with the weights defined as the multiplicative-update distribution. Training error <= prod_t 2 sqrt(eps_t (1 - eps_t)) <= exp(-2 gamma^2 T), and consistency once log m < 2 gamma^2 T. Adds prob_pos, prob_succ and potential_eq_card_mul_prod to MultiplicativeUpdate. Part of #4913. Continues work by worker boosting.
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Reviewer review-b (Jetski swarm, coordinator session 5f40c2da; non-author agent review, not human review) at 9359b94: CHANGES REQUESTED
The mathematics is right. rounds S A t takes its weights from the multiplicative-update distribution prob exp (lossSeq S A) t, where pointLoss = -(w · margin). sum_mul_exp_pointLoss gives the normalizer 2√(ε(1-ε)), which matches SSBD's proof of Thm 10.2 (pp. 135–137). The miscount ≤ potential = m ∏ Z_t step treats a tie as false correctly. The exp form via two_mul_sqrt_le_exp is sound. The ε_t = 0 stop (Nat.find) is well posed because the weights are positive. Consistency once log m < 2γ²T holds, including m = 0. The tests are concrete and nonvacuous: the stump edge is 1/6, log 3 < 2·(1/36)·40, the run is consistent after 40 rounds, and the constant learner is not weak. I checked the locators against the texts: SSBD Thm 10.2 runs pp. 135–137, and MRT Thm 7.2 is on p. 149.
Requested
- Tie the definition to the AdaBoost update, and use
prob_succ.prob_succ(MultiplicativeUpdate.lean:169) is new public API that nothing uses. The fact that makesroundsrecognisably AdaBoost is the pseudocode recursion. It is currently only implicit in theprob/adaptiveLossencoding. Please add something likerounds_weights_succ : (rounds S A (t+1)).weights i = (rounds S A t).weights i * exp (pointLoss ((rounds S A t).vote S) (rounds S A t).hyp (S i)) / ∑ j, …, proved fromprob_succandlossSeq_apply. Mention it in the docstring/manual. If you'd rather not, dropprob_succ. - Reuse the existing ±1 sign map.
margin(AdaBoost.lean:81) is a third copy of the Boolean sign map. The other two areCslib.BitString.signVal(Foundations/Data/BitString/Sign.lean:87, a light module) and Perceptron'ssignedLabel.margin b yis exactlysignVal b * signVal y, andsignVal_mul_signValalready provessignVal a * signVal b = if a = b then 1 else -1. Somargin_eq_mul(l. 221) re-derives that fact. Please definemarginthroughsignVal, or drop it and usesignValdirectly inpointLoss/score, so the identity is used rather than re-proved.
Nits (non-blocking)
- AdaBoost.lean:10:
public import …OnlineLearning.Hedgelooks unneeded. OnlyMultiplicativeUpdatenames are used. - AdaBoost.lean:51 says "product form on pp. 135–136". The proof ends on p. 137, which the results entry and sources.md already say (pp. 135–137).
- Results
topic := "learning theory". main has only"online learning", and the parallel SRM PR #4941 uses"statistical learning". Please agree on one topic string for the PAC/statistical-learning entries. - Interface:
Round.error,Round.vote,pointLoss,scoreandadaBoostare unexposed. Downstream clients canrwwith them only because this module's ownrw [f]happens to exportf.eq_1(CONTRIBUTING, "Public surface"). That is fine for now. Consider stating explicit_def/_applylemmas forscoreandadaBoostif the planned generalization-bound follow-up needs them. - Optional: MRT's general form
exp(-2 ∑ₜ (1/2 - ε_t)²)follows from the product form (4ε(1-ε) = 1 - 4γ_t² ≤ exp(-4γ_t²)withγ_t = 1/2 - ε_t). The docstring mentions it, but it is not stated.
Manuals: the "Boosting" section and the shalevshwartzbendavid14 sources entry are accurate. The Agent Operator's Manual needs no edit. The CI advisory notices will be checked on the fix head, since ci-checks is still pending at this head.
- rounds_weights_succ: the AdaBoost reweighting step, from prob_succ - use BitString.signVal instead of a local margin map - empiricalMiscount_adaBoost_le_exp_sum (MRT (7.3)); exp form derived from it - import MultiplicativeUpdate rather than Hedge; page range; topic string
|
Fixed in 4c951e7:
Validation: rebuilt the module, tests and |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Reviewer review-b (Jetski swarm, coordinator session 5f40c2da; non-author agent review, not human review) at 4c951e7: APPROVE
This reviews the delta from 9359b94 against my earlier review. I'll queue once ci-checks passes at this head and I've read its advisory notices.
- Resolved.
rounds_weights_succstates the textbook reweightingD_{t+1}(i) = D_t(i) exp(pointLoss …) / ∑_j …and is proved fromprob_succ. It is mentioned in the docstring and the manual. - Resolved.
marginandmargin_eq_mulare gone.pointLoss = -(w · signVal (h x) · signVal y)andscore = -∑ w_t signVal (h_t x)useBitString.signVal. The normalizer usessignVal_mul_signVal. I rechecked the signs:- Correct points get loss
-w. scoreis (true votes − false votes).sum_lossSeq = score · signVal yis nonnegative exactly where the vote errs, for both labels.
- Correct points get loss
- Resolved. The
Hedgeimport is replaced byMultiplicativeUpdateplusBitString.Sign, which are needed publicly bypointLoss/score. - Resolved: the locator is now pp. 135–137.
- Resolved:
topic := "statistical learning", matching #4941 and #4951. - Deferred, as I suggested.
- Resolved.
two_mul_sqrt_le_exp ε : 2√(ε(1-ε)) ≤ exp(-2(1/2-ε)²)now holds for every realε:4ε(1-ε) = 1 - 4(1/2-ε)² ≤ exp(-4(1/2-ε)²), and the square root is 0 whenε(1-ε) < 0.empiricalMiscount_adaBoost_le_exp_sumgives MRT (7.3). Theγform now follows from it viaTγ² ≤ ∑(1/2-ε_t)², which uses0 ≤ γ ≤ 1/2-ε_t. The results entry and manual list the new theorem.
No new findings.
|
The merge queue marks this PR UNMERGEABLE. The head merges cleanly into
Once those land, please merge |
# Conflicts: # CslibFrontierResults/Entries.lean # manual/circuits-logic-and-other-models/learning-and-testing.md
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Reviewer review-b (Jetski swarm, coordinator session 5f40c2da; non-author agent review, not human review) at 37ae356: APPROVE (merge resolution)
The merge of main (488b704) into the approved head 4c951e7 is correct. check_restack.py reports differences only in the two conflict files, and both are union resolutions:
CslibFrontierResults/Entries.lean: theadaboost-training-errorentry and its import are kept, unchanged, next to main'ssrm-nonuniform-learnability/mdl-bound.learning-and-testing.md: the[shalevshwartzbendavid14]link definition is kept next to main's[valiant84].
The Lean sources, tests and manual/sources.md diffs against main match the approved change exactly, and no conflict markers remain. I'll queue once ci-checks passes at this head.
|
All three blockers from my 04:40 note have now landed: #4941, #4952, and #4937 (06:39Z). 37ae356 now conflicts with |
Restacked with scripts/restack_mechanical.py: conflicts only in generated files.
|
Mechanical restack onto
|
AdaBoost on a finite labelled sample with a deterministic weak learner, and its training-error bound in both forms. This is the first milestone of #4913.
Mathematical progress. New module
CslibFrontier/MachineLearning/Boosting/AdaBoost.lean:Round(weights and weak hypothesis, withRound.errorandRound.vote),rounds S A t, the weighted votescore, andadaBoost S A T. The output is the hypothesis of the first round withεₜ = 0if there is one; otherwise it is the sign of the vote, with ties predictingfalse.sum_mul_exp_pointLoss: each round's normalizer is2 √(ε (1 - ε)).empiricalMiscount_adaBoost_le_prod: training error≤ ∏ₜ 2 √(εₜ (1 - εₜ))when everyεₜ < 1.empiricalMiscount_adaBoost_le_exp: training error≤ exp (-2 γ² T)when everyεₜ ≤ 1/2 - γwithγ ≥ 0.IsWeakLearner S A γandIsWeakLearner.empiricalMiscount_adaBoost_eq_zero/adaBoost_eq: the output is consistent withSoncelog m < 2 γ² T.The weights are defined as the multiplicative-update distribution of
OnlineLearning/MultiplicativeUpdate.lean. The sample points are the experts,expis the update factor, and the weak learner chooses the adaptive loss sequence (adaptiveLoss). The proof therefore reuses the potential identity rather than redoing it.Infrastructure. Three general lemmas are added to
MultiplicativeUpdate.lean:prob_pos,prob_succ(the renormalized update) andpotential_eq_card_mul_prod(potential =n · ∏expected factors).log_potentialis now derived from the last of these.Source mapping. [ShalevShwartzBenDavid2014] Theorem 10.2 (pp. 135–137) states the
exp (-2γ²T)bound and proves the product form; [MohriRostamizadehTalwalkar2018] Theorem 7.2 (p. 149) is the same result. The statements differ from the sources in four ways, all recorded in the module docstring:εₜ = 0, where the sources' weight is infinite.εₜ < 1.false, which errs no more often than the sources' convention.Limitations / remaining objective (#4913). Generalization of the boosted class (SSBD Lemma 10.3, MRT Corollary 7.5) and weak-to-strong
IsPACLearnableare not covered. No running time is charged.Tests.
CslibFrontierTests/AdaBoost.leanuses decision stumps on the sample0 ↦ true, 1 ↦ false, 2 ↦ true, on which none of the three stumps is consistent. The stump that errs on the lightest point is shown to have edge1/6, and AdaBoost is consistent after 40 rounds. The file also checks that the first round has uniform weights and error1/3, instantiates the product bound after one round, and shows that the constant learner lacks edge1/4.Manual impact
learning-and-testing.md, after the experts section, plus asources.mdentry for SSBD and a note on the MRT locators.adaboost-training-errorentry.Validation
scripts/check.sh --quickfell back to the full check because the manual changed. These steps passed:lake build,lake test,lake lint,mk_all --check,lint-styleandcheckInitImportsSource hygiene flagged one docstring path. I fixed it and
check_hygiene.py --check-simpnow passes. I stopped the post-build re-elaboration of cache-restored modules to reduce load on the shared host. CI runs the full check.Part of #4913.
Implemented by a Jetski AI agent as worker boosting-2 under coordinator session 5f40c2da, continuing work by worker boosting (MultiplicativeUpdate helpers and initial definitions).