Repository navigation
feat: online learners, closed-loop runs, regret guarantees, restart/product/sum/map, and the FTRL learner - #286
Open
RemyDegenne wants to merge 1 commit into
Conversation
…s, restart/product/sum/map, and the FTRL learner Co-Authored-By: Claude Code <noreply@github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR defines causal deterministic online learners and their runs, the closed-loop run, the regret-guarantee predicate, the operations used by the reductions (restart, the coordinatewise product, the sum of plays, and post-composition of plays, which gives translation), and the FTRL learner as an instance. This is the milestone OnlineLearning Layer 0.2 ("Online learners") of LMLRoadmaps, together with the second completion check of Layer 0 (the regret of a learner restarted at round
sover[s, s + τ)is the regret of the original learner over[0, τ)on the shifted feedback).New modules:
LMLExplore/OnlineLearning/Learner/Basic.leandefinesOnlineLearner C G X(@[ext]structure with one field,play : (t : ℕ) → (Fin t → C × G) → C → X, following the signature inSuggested.lean) andrun. It proves causality (run_congr,run_congr_feedback) and that a learner is determined by its runs (ext_run, given[Nonempty G]). It definesclosedLoopFeedback, by well-founded recursion on the round, and characterises it as the unique fixed point ofg ↦ fun t ↦ φ t (A.run c g t)(closedLoopFeedback_eq,eq_closedLoopFeedback_of_forall_lt,closedLoopFeedback_unique,closedLoopFeedback_congr). It also definesHasRegretBound A L adm U B, withhasRegretBound_iff,HasRegretBound.regret_leandHasRegretBound.mono. The predicate takes a general loss evaluationL : G → X → ℝand is stated through the existingregret, so it covers linear losses (L y x = y x) as well as expert losses.LMLExplore/OnlineLearning/Learner/Operations.leancovers the four operations:restart, withrun_restart_add,run_restart_of_lt,restart_zero,intervalRegret_run_restart(the completion check) andHasRegretBound.intervalRegret_run_restart_le;pi, for any index type, withrun_pi,regret_run_piandHasRegretBound.pifor separable losses∑ i, L i (g i) (x i), the form AdaGrad (Layer 2.4) consumes;OnlineLearner.sum, withrun_sum,regret_run_sumandregret_run_sum_le[Ora, Theorem 13.11], stated as the inequality for every decomposition, as the roadmap's Layer 13.3 correction asks;map, withrun_map,map_id,map_map,regret_run_map, and the translation statementsregret_run_map_add_leftandHasRegretBound.map_add_left[Ora, Proposition 13.10].LMLExplore/OnlineLearning/FTRL/Learner.leandefinesOnlineLearner.ftrl K F η x₀. At each round it plays a chosen minimizer of the FTRL objective when one exists, andx₀otherwise. Its runs satisfyIsFTRLPlay(isFTRLPlay_run_ftrl, andisFTRLPlay_run_ftrl_of_isCompactviaexists_ftrl). With a strongly convex potential that is differentiable withinK, it satisfiesHasRegretBound(hasRegretBound_ftrl_of_strongConvexOn, from the existingftrl_regret_le_of_strongConvexOn_of_antitone, [Ora, Corollary 7.6]). This is a non-degenerate witness of the new predicate.On reuse: LML's
Learning.Algorithm.deterministicis the measurable, kernel-based counterpart for stochastic environments. It requires measurable spaces and measurable policies, and its history contains the learner's own actions. The roadmap's Layer 0.2 asks for a measure-free causal learner whose play is a function of the past contexts and feedback, and Layers 6.5 and 12–16 compose such learners, so a separate structure is needed. The module docstring points to the LML counterpart. No existing declaration is removed or renamed.After this PR, Layer 0.2 still needs:
IsMirrorDescentStep.Roadmap: OnlineLearning
🤖 Prepared with Claude Code