Log inStart free
LESSON 15.22 · 6 STAGES · 3 CONTROLS · 2 CHECKSPRO · PREVIEW

Q-learning

Watch Q-learning learn the shortest route past a cliff while it still explores.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 15.22 · CLIFF GRID4 × 12 GRID · STEP −1 · CLIFF −100
01
Stage 1 of 6 · Cliff world
Each step costs a reward of −1. A step into the cliff costs −100 and sends the agent back to the start.
Explain it simply

You see a grid of 48 cells. The agent begins in the start cell and must reach G, and every step costs one point. The red cliff costs a hundred points and sends the agent back to the start. The teal line is the last training episode: 13 steps.

A grid of 4 rows and 12 columns. The start is bottom left, G bottom right, and the 10 cells between them are the cliff. The last training episode of run 1 takes 13 steps, return −13.

agent and routeaction values, target, πbehavior chance bcliff, a move 40+ below the best
the cliff worldstartGthe cliff: −100 and back to starteach step: reward −1into the cliff: −100, back to startonto G: the episode endslast episode: 13 steps, return −13the cliff worldstartGthe cliff: −100 and back to starteach step: reward −1into the cliff: −100, back to startonto G: the episode endslast episode: 13 steps, return −13
Toy: the 4 × 12 cliff grid; values are the mean of 20 seeded runs of 500 episodes
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
G=∑tRt+1\sy{g}{out}{G} = \sum_t \sy{r}{data}{R_{t+1}}
G=−13G = -13

The return adds every reward of one episode.

Common mix-ups

MYTHQ-learning always earns more while it trains: its route is shorter.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01If ε rises from 0.1 to 0.2, does Q-learning's learned route move away from the edge?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.