Multi-Armed Bandit
Principles
- Naive exploration - add randomization to greed policy (e.g., -greedy)
- Optimistic initialization - assume the best until proven otherwise
- Optimism in the face of uncertainty - prefer actions with uncertain values
- Probability matching - select actions according to probability they are best
Overview
A multi-armed bandit is a tuple . is a known set of actions or arms.
is unknown probability distribution of rewards. At each step t the agent selects an action .
The environment generates a reward and the goal is to maximize total reward .
Regret
The action-value is the mean reward for action a, . The optimal value is .
Regret is the opportunity loss for one step. Regret is a function of gaps : Total regret is the total opportunity loss: . Maximizing total reward is equivalent to minimizing total regret.
Average sampling and -greedy have linear total regret. Decaying -Greedy has logarithmic regret, which is a theoretical lower bound on complexity of regret. UCB also achieves logarithmic regret. Thompson sampling hits theoretical minimum.
Strategies
Objective is find a policy that maximizes total cumulated reward, , where is the arm selected by at time , and is the reward obtained at time after selecting the arm .
e-greedy
The -greedy strategy sometimes acts greedily, and sometimes selects a random action to improve exploration:
Incremental Implementation of Sample Averaging
The fraction has nice convergence properties–diverging at while its square converges at .
An -greedy average-sampling bandit algorithm from the Sutton book:
-
Initialize, for a = 1 to :
-
-
Loop forevers:
Discounting
We can use discounting instead of averaging to overcome nonstationarity.
Upper Confidence Bounds (UCB)
UCB follows an optimistic strategy and selects the best arm in the best case scenario, i.e., according to the upper bounds on the arms value estimates:
Gradient Bandit
is a preference function in which only the relative ranking order matters. The function has no other interpretability. The function is updated using a stochastic gradient ascent process. The policy function uses the softmax probabilities of H over all actions.
is updated on each step after selecting action by:
is the average of rewards up to but not including time t and . is the step-size parameter.
The expected reward is the probability weighted reward of each action:
Baselines reduce variance by subtracting the mean and centering values at zero and reducing the magnitudes. We are not subtracting from the gradient but from a number that multiplies the gradient.
Thompson Sampling
“Thompson Sampling follows a Bayesian approach and considers a parametric model with a prior . For instance, in the linear case: and . Then, at each iteration t, we sample from and select the arm .”
In other words, Thompson sampling constructs a sample distribution or rewards for each arm based on sampling statistics from past rewards such as mean and variance. Then, at each iteration, a sample item is taken from each arm based on its distribution and the policy is the choose the arm with the highest sampled value.
Thompson sampling is useful for multi-armed bandits but does not easily extend to other reinforcement learning techniques.
