Log inStart free
LESSON 15.20 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Temporal-difference learning

Watch each move of a random walk correct a guess with the next guess.


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

Go Pro · $8.25/mo
EXPLAINER · 15.20 · RL BAYEPISODE 1 · 9 MOVES · LAST TARGET 1.000
01
Stage 1 of 6 · TD target
Each move gets a TD target: its reward plus γ times the next guess, V(S′). Using a guess this way is bootstrapping.
Explain it simply

The strip shows episode 1, the same walk as in Monte Carlo. Under each move sits its target. The last move pays 1, and the end has no future, so its target is 1. Every other move pays 0 and lands on a guess of 0, so its target is 0.

Targets of the 9 moves of episode 1: 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.000.

statestargets and valuesTD errorstrue valueother step sizes, Monte Carlo
startleft endright endV0A0.000B0.000C0.000D0.000E0.000+1Rtarget0C10.000B20.000A30.000B40.000C50.000B60.000C70.000D80.00+1E91.00+1TD targetslast move: target = 1 + 0.9 × 0.000 = 1.000startleft endright endV0A0.000B0.000C0.000D0.000E0.000+1Rtarget0C10.000B20.000A30.000B40.000C50.000B60.000C70.000D80.00+1E91.00+1TD targetslast move: target = 1 + 0.9 × 0.000 = 1.000
Toy: the 7-state random walk, γ = 0.9, seeded episodes
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
target=R+γ V(S′)\sy{target}{out}{\text{target}} = \sy{R}{out}{R} + \sy{gamma}{param}{\gamma}\,\sy{Vn}{out}{V(S')}
target=1+0.9×0.000=1.000\text{target} = 1 + 0.9 \times 0.000 = 1.000

The target is the reward plus the discounted next guess.

Common mix-ups

MYTHTD waits for the episode end, like Monte Carlo.

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

Predict, then reveal
3 CHECKS · PRO
Q01With every guess at 0.5, how many moves of episode 1 have a nonzero TD error?

Make your guess, then test it in the diagram. All 3 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 3 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.