Thompson sampling
Thompson sampling, named after William R. Thompson, is a heuristic for choosing actions that address the exploration–exploitation dilemma in the multi-armed bandit problem. It consists of choosing the action that maximizes the expected reward with respect to a randomly drawn belief.
Description
Consider a set of contexts, a set of actions, and rewards in. The aim of the player is to play actions under the various contexts, such as to maximize the cumulative rewards. Specifically, in each round, the player obtains a context, plays an action and receives a reward following a distribution that depends on the context and the issued action.The elements of Thompson sampling are as follows:
- a likelihood function ;
- a set of parameters of the distribution of ;
- a prior distribution on these parameters;
- past observations triplets ;
- a posterior distribution, where is the likelihood function.
where is the indicator function.
In practice, the rule is implemented by sampling. In each round, parameters are sampled from the posterior, and an action chosen that maximizes, i.e. the expected reward given the sampled parameters, the action, and the current context. Conceptually, this means that the player instantiates their beliefs randomly in each round according to the posterior distribution, and then acts optimally according to them. In most practical applications, it is computationally onerous to maintain and sample from a posterior distribution over models. As such, Thompson sampling is often used in conjunction with approximate sampling techniques.
History
Thompson sampling was originally described by Thompson in 1933. It was subsequently rediscovered numerous times independently in the context of multi-armed bandit problems. A first proof of convergence for the bandit case has been shown in 1997. The first application to Markov decision processes was in 2000. A related approach was published in 2010. In 2010 it was also shown that Thompson sampling is instantaneously self-correcting. Asymptotic convergence results for contextual bandits were published in 2011. Thompson Sampling has been widely used in many online learning problems including A/B testing in website design and online advertising, and accelerated learning in decentralized decision making. A Double Thompson Sampling algorithm has been proposed for dueling bandits, a variant of traditional MAB, where feedback comes in the form of pairwise comparison.Relationship to other approaches
Probability matching
Probability matching is a decision strategy in which predictions of class membership are proportional to the class base rates. Thus, if in the training set positive examples are observed 60% of the time, and negative examples are observed 40% of the time, the observer using a probability-matching strategy will predict a class label of "positive" on 60% of instances, and a class label of "negative" on 40% of instances.Bayesian control rule
A generalization of Thompson sampling to arbitrary dynamical environments and causal structures, known as Bayesian control rule, has been shown to be the optimal solution to the adaptive coding problem with actions and observations. In this formulation, an agent is conceptualized as a mixture over a set of behaviours. As the agent interacts with its environment, it learns the causal properties and adopts the behaviour that minimizes the relative entropy to the behaviour with the best prediction of the environment's behaviour. If these behaviours have been chosen according to the maximum expected utility principle, then the asymptotic behaviour of the Bayesian control rule matches the asymptotic behaviour of the perfectly rational agent.The setup is as follows. Let be the actions issued by an agent up to time, and let be the observations gathered by the agent up to time. Then, the agent issues the action with probability:
where the "hat"-notation denotes the fact that is a causal intervention, and not an ordinary observation. If the agent holds beliefs over its behaviors, then the Bayesian control rule becomes
where is the posterior distribution over the parameter given actions and observations.
In practice, the Bayesian control amounts to sampling, at each time step, a parameter from the posterior distribution, where the posterior distribution is computed using Bayes' rule by only considering the likelihoods of the observations and ignoring the likelihoods of the actions, and then by sampling the action from the action distribution.