Q-learning and temporal-difference learning
Exploration, Monte Carlo vs TD(0), SARSA and Q-learning, cliff walking, and tabular convergence.
From a model to samples
Games and Monte Carlo tree search still needed a model: rules, a simulator, or experience from which to learn one. Value iteration needs and explicitly. Most agents have neither. They act, see one transition , and must improve from that. Reinforcement learning estimates the Bellman expectations by averaging samples: estimate ← estimate + (target − estimate).
Exploration and bandits
Strip the MDP to one state: a multi-armed bandit. Greedy can stick forever on a bad first sample. -greedy explores forever and pays linear regret. UCB1 pulls
and achieves logarithmic regret. At , , , , the scores are , , — UCB tries the worst-looking arm. On the 10-armed testbed, late reward: greedy , , UCB .
Monte Carlo and TD(0)
Monte Carlo prediction waits for : unbiased, high variance, only at episode end. TD(0) bootstraps after one step:
Key idea. A value must be consistent with itself: one reward plus the next state’s value. TD moves estimates toward that consistency without waiting for the true return. On the random walk A–E (true values ), if , , a step C→D with and yields . The Monte Carlo error equals the discounted sum of TD errors along the episode.
SARSA and Q-learning
Control needs , so greedy improvement is without . SARSA is on-policy: target with from the behaviour policy. Q-learning is off-policy: target — a sample of the Bellman optimality equation — and learns while exploring.
Cliff walking
On cliff walking (), Q-learning’s greedy path hugs the edge (return ), but -greedy behaviour on that path averages . SARSA learns the safer upper path; the best -greedy policy averages . One edge update: Q-learning target ; SARSA’s expected target because a random fall costs extra. If exploration will stop, prefer ; if the agent must keep exploring while acting, prefer SARSA’s caution.
Convergence and next
With Robbins–Monro steps , and infinite visits, TD(0) → , Q-learning → ; SARSA needs GLIE exploration too. Tables do not generalize: Atari screens never repeat. Next: replace the table by a network — deep Q-networks, with replay and a target network to survive the deadly triad.
Check your understanding
The same questions as in Pulse. Answers are shared between modes.
Go deeper — optional
Code and labs do not count toward the main percentage or the certificate.
- One Q-learning updateoptional
Apply Q(s,a) ← Q + α[r + γ max Q(s',·) − Q] on a 2×2 table; match the new value.
~20 min · easier on a computer · The matching course topic has been read.
Self-check in the notebook — not part of mastery or the certificate.
Answers are saved on the server and tied to this browser until you sign in.