Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Multi-Armed Bandit Algorithms

Choose repeatedly among options with unknown payoffs, balancing trying and exploiting.

The idea

Like a row of slot machines: each pull of an arm gives a random reward from an unknown distribution. You want to maximise total reward, which means exploring enough to find the best arm but exploiting it as soon as you can. Regret measures how much reward you lose compared with always pulling the best arm.

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

total regret (reward lost by not always playing the best arm)pulled 1×arm 1pulled 0×arm 2pulled 0×arm 3pulled 0×arm 4pulled 0×arm 5
  • estimated value
  • true value (dashed)
  • arm just pulled

Pull 1: Exploit: pick the arm that looks best so far. Got reward 0.51.

pulls:
1
regret:
0.84
1/40

Bars are what the agent believes; dashed lines are the truth it is trying to discover.

Step by step

  1. 1Keep an estimate (and uncertainty) for every arm.
  2. 2Choose an arm with a strategy: ε-greedy, UCB or Thompson sampling.
  3. 3Observe the reward.
  4. 4Update that arm's estimate.

Where it is used

Website optimisation, clinical trials, content recommendation.

Watch out for

Assumes the arms' payoffs do not change over time and that each choice does not alter the future state.

Related