2.7. Online.Bandit.Algorithms.TS
Thompson Sampling
This file defines the Thompson sampling algorithm. This algorithm samples an action according to its probability of being optimal under the posterior over environments given the history so far.
Main definitions
-
tsAlgorithm hK Q κ: a Thompson sampling algorithm with actions inFin KgivenhK : 0 < K, a prior distribution over parametersQ : Measure 𝓔, and a Markov kernelκ : Kernel (𝓔 × Fin K) ℝ. This kernel defines how a parametere : 𝓔gives rise to a stationary environment:stationaryEnv (κ.sectR e) : Environment (Fin K) ℝ.
Main results
-
hasCondDistrib_action: if Thompson sampling has the correct prior over environments, then the conditional distribution of the next action given the history so far is equal to the conditional distribution of the best action given the history so far.
Module LeanMachineLearning.Online.Bandit.Algorithms.TS contains 6 exposed declarations.
-
Bandits.TS.policy -
Bandits.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdFinRealPolicy -
Bandits.TS.initialPolicy -
Bandits.instIsProbabilityMeasureFinInitialPolicy -
Bandits.tsAlgorithm -
Bandits.TS.hasCondDistrib_action