Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Temporal Difference Learning (TD)

Updates a value estimate toward a one-step lookahead without waiting for the episode to end.

The idea

TD bootstraps: it updates V(s) toward the reward plus the current estimate of the next state's value. The gap between the two is the TD error. This learns online, step by step, with lower variance than Monte Carlo, at the price of some bias from using an estimate.

δ = r + γ V(s′) − V(s)

Watch it run

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

GOAL +1PIT −1start0000000000000-0.020000
  • positive value
  • negative value
  • agent

TD(0): after one step, move V(state) a bit toward reward + γ·V(next state) = -0.04.

episode:
1
1/78

The agent wanders randomly; we are only measuring how good each cell is.

Step by step

  1. 1In state s take an action and observe r and s′.
  2. 2Compute the TD error δ = r + γ V(s′) − V(s).
  3. 3Move V(s) a fraction α toward the target.
  4. 4Continue from s′.

Where it is used

The foundation of Q-learning, SARSA and actor-critic.

Watch out for

Bootstrapping with function approximation can diverge.

Related