Refactor Algorithm and Environment - #229
Conversation
Resolve the conflict in ArrayProbSpace.lean by taking the merged range version (main's truncRow structure and reworked independence proofs, Fin-indexed history) and re-applying the newAlg adaptation to the three-parameter Algorithm Unit 𝓐 𝓡 API (Hist, Round, noObs, sectL). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| rw [Kernel.sectR_apply, Kernel.compProd_apply hs, Kernel.compProd_apply hs] | ||
| rfl | ||
|
|
||
| section IsAlgEnvSeq |
There was a problem hiding this comment.
In the spirit of getting Algorithm and Environment right once and for all, have you considered "bundling" the processes {O : ℕ → Ω → 𝓞} {A : ℕ → Ω → 𝓐} {Y : ℕ → Ω → 𝓨} into a structure or abbreviation? They almost always appear together, and conceptually this makes sense.
For example, if we had such an S : LearningProcess, then we could have S.IsAlgEnvProcess alg env P, and other random variables could be defined in the LearningProcess namespace. For example, we could have S.history n.
I am not saying this is definitely the way to go, but I want to hear your thoughts.
There was a problem hiding this comment.
I think we should not do it. There would be projections S.action, S.obs everywhere in the code, which is heavier than just A or O. Also Mathlib uses a lot of function/process properties that would apply to projections but not to the structure unless we duplicate a log of API (Adapted, HasLaw, HasCondDistrib...), again forcing projections.
There was a problem hiding this comment.
We would probably want to access the actions/observations/feedbacks through S.A/S.O/S.Y. I agree that the code becomes heavier when dealing with these variables, but it is also becomes lighter when dealing with derived variables, which are already much more verbose (for example, S.history n is an improvement over history O A Y n ). But I don't want to press the issue too much - I trust your judgement.
|
Thanks Rémy! I think Regarding the Bayesian setting, attempting a further generalization to a prior over |
Each round had two components: action and feedback. Now we have 3: observation -> action -> feedback.
If fits naturally settings like contextual bandits or prediction with expert advice, and it allows a nice refactor of
IsBayesAlgEnvSeq, which can be written asin which
bayesStationaryEnv Q κis aEnvironment 𝓔 𝓐 𝓨.Depends on #226