liveBook · Manning

Epsilon-greedy

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An action-selection strategy that chooses a random action with a specified probability and otherwise selects the currently best-known action.

Epsilon-greedy balances exploration and exploitation by selecting a random action with probability epsilon and the currently highest-valued action otherwise. In a multi-armed bandit, it occasionally tests uncertain slot machines instead of committing permanently to an early, possibly misleading winner. section 12.1.6

Three slot machines

Consider 90 trials with machines whose payoff distributions have means 8, 10, and 5. With epsilon set to 0.1, each trial randomly explores with probability 0.1; otherwise, the implementation selects the machine with the highest estimated mean. The sample run reports average regret of 0.3466, between explore-only regret of 2.246 and exploit-only greedy regret of 0.048. section 12.1.6

A NumPy implementation follows this loop:

  • Draw a random number and compare it with epsilon. section 12.1.6
  • Select a random arm when exploring; otherwise select the arm with the highest mean payoff. section 12.1.6
  • Sample the selected arm’s payoff, calculate regret against the maximum mean reward, and accumulate the result. section 12.1.6
Figure 12.7 Three slot machines as a noncontextual multi-armed bandit (MAB) problem. The payoff distribution’s mean and standard deviations of these three machines are (8,0.5), (10, 0.7), and (5, 0.45), respectively.

Compare the three payoff distributions visually before experimenting with epsilon and cumulative regret. section 12.1.6

A small epsilon preserves discovery while exploitation uses current estimates. The strategy is one option alongside explore-only, exploit-only greedy, and upper confidence bound methods for maximizing cumulative reward. section 12.1.6 section 12.7

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Explains the selection rule, loop steps, epsilon parameter, regret calculation, and comparison with alternative bandit strategies.
Examples
Uses three slot machines, 90 trials, payoff distributions, NumPy code, and average-regret comparisons.
What it assumes
Assumes multi-armed bandit framing, payoff distributions, cumulative reward, and regret as decision-quality measures.
What you can do after
Apply it via NumPy by implementing random exploration, greedy exploitation, payoff sampling, and regret tracking.
How it connects
Connects exploration, exploitation, regret, multi-armed bandits, and upper confidence bound methods.

Also explained in

Compare how 3 books explain epsilon-greedy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.