Bandits.tsAlgorithm
The Thompson sampling algorithm with actions in Fin K, where Q : Measure π is a prior
distribution over parameters, and ΞΊ : Kernel (π Γ Fin K) β is a Markov kernel that defines the
stationary environment stationaryEnv (ΞΊ.sectR e) that corresponds to a parameter e : π.
At every time n, the Thompson sampling policy uses the posterior over the parameters given the
history up to time n to derive the probability of each action being optimal. The action for time
n is sampled according to these probabilities.
Bandits.tsAlgorithm.{u_1} {K : β} {π : Type u_1} [MeasurableSpace π] [StandardBorelSpace π] [Nonempty π] (hK : 0 < K) (Q : MeasureTheory.Measure π) [MeasureTheory.IsProbabilityMeasure Q] (ΞΊ : ProbabilityTheory.Kernel (π Γ Fin K) β) [ProbabilityTheory.IsMarkovKernel ΞΊ] : Learning.Algorithm (Fin K) βBandits.tsAlgorithm.{u_1} {K : β} {π : Type u_1} [MeasurableSpace π] [StandardBorelSpace π] [Nonempty π] (hK : 0 < K) (Q : MeasureTheory.Measure π) [MeasureTheory.IsProbabilityMeasure Q] (ΞΊ : ProbabilityTheory.Kernel (π Γ Fin K) β) [ProbabilityTheory.IsMarkovKernel ΞΊ] : Learning.Algorithm (Fin K) β
Code
noncomputable
def tsAlgorithm (hK : 0 < K) (Q : Measure π) [IsProbabilityMeasure Q] (ΞΊ : Kernel (π Γ Fin K) β)
[IsMarkovKernel ΞΊ] : Algorithm (Fin K) β where
policy := TS.policy hK Q ΞΊ
p0 := TS.initialPolicy hK Q ΞΊActions: Source Β· Open Issue
Meaning last changed in v4.34.0-rc2-1-g439785b (2026-08-23), the 4th recorded change.
Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file Β· open it in the Lean web editor.
Dependency graph
Audit surface: 19 project declarations, 74 external constants
β Proved: no sorry anywhere in its closure
This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.