Unit 2 of 13 · about 3 hours · derive
Incremental means, constant step sizes and learning-rate conditions
Every tabular update in this section is an incremental average in disguise. The step-size choice decides whether old bias dies out or new samples keep overwriting the past.
You'll be able to
- Derive the incremental mean update and the constant step-size update from the averaging definition.
- State the step-size convergence conditions and explain which part tracking violates and why.
- Predict how initialization bias decays under decreasing versus constant step sizes.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Incremental and tracking updatesReinforcement Learning: An Introduction (2nd ed.) - Chapters 2, 5, 6 and 7
Chapter 2, Sections 2.4 and 2.5, equations (2.3) to (2.7) with Exercises 2.4 and 2.5 (printed pp. 30 to 33)
Skip the bandit testbed and action-selection sections; read only the update rules and the step-size discussion.
- Constant step-size arithmetic in the corridor tablesHands-on Modern RL - Dynamic Programming, Monte Carlo and TD
The MC and TD worked tables, which both move old values toward targets with (page read 2026-10-14)
Read the tables as arithmetic examples of constant step sizes, not as converged values.
Focus on
- The general template is from (2.4). The sample mean uses ; tracking uses constant from (2.5).
- Constant gives recent rewards exponentially more weight, , so the initial bias decays but old samples are discounted forever.
- Convergence needs with from (2.7). Constant fails the second sum, which is why it tracks drift instead of converging.
- Visitation gates learning: rarely visited pairs take fewer steps, so their estimates move slower at any shared .
Common mistakes · 3
- Using everywhere because it removes bias fastest. It also removes all memory, so one noisy reward decides the estimate.
- Assuming constant converges because early bias decays. The bias from decays as , but the variance never settles since every new sample keeps weight .
- Treating unvisited pairs as learned. No visit means no update at that step size; a shared schedule does not teach pairs the behavior policy never tries.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Rewards arrive as 10 then 0 with and constant . What is ?Answer
, then . The first reward keeps weight .
2.Which convergence sum does constant violate?Answer
The squares sum: diverges for constant , so noise never averages out. The plain sum still holds.
3.Why does converge slowly in practice?Answer
Later samples get weight , so after many visits each new return barely moves the estimate even when the policy has changed.
4.A pair is visited once in 10,000 steps. What does a shared step size imply?Answer
Its estimate took one step from initialization. Visit counts gate learning; the schedule cannot compensate for missing coverage.
You're done when
You derive (2.4) to (2.7) closed-book, reproduce the 2.125 weighting by hand, and can predict which schedule tracks a drift and which converges.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 5 more in the section
- Reinforcement Learning: An Introduction (2nd ed.) - Chapters 2, 5, 6 and 7Richard Sutton and Andrew Barto · primary
The authors post the full second edition free at incompleteideas.net; cite the printed page numbers. Study Sections 2.4 and 2.5 (incremental and constant step-size estimates), Chapter 5 without the starred sections (Monte Carlo prediction and control, ordinary and weighted importance sampling), Chapter 6 Sections 6.1 to 6.7 (TD(0), Sarsa, Q-learning, Expected Sarsa, maximization bias) and Chapter 7 Sections 7.1 to 7.3 (n-step methods). Reproduce Example 5.4 (off-policy blackjack), Example 6.2 (random walk) and Example 6.6 (cliff walking), and implement each update from fixed hand-calculated trajectories before training an agent.
- Hands-on Modern RL - Dynamic Programming, Monte Carlo and TDWalking Labs · support
Use the DP, MC and TD page and the bandit script as a code companion. Rebuild the algorithms in the shared track schema, and keep the bandit comparison as a seed-sensitivity case: which method wins changes with the seed. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers.
Also in this section
- Stanford CS234 Winter 2026 - Policy Evaluation and Q-LearningStanford University · required
Study Lecture 3 (tabular policy evaluation) and Lecture 4 (Q-learning) slides and the relevant independent Assignment 1 and 2 written questions. Use the course treatment to state model-access, convergence, coverage and function-approximation assumptions for each update.
- Gymnasium Core APIFarama Foundation · reference
Use the reset, step, seeding and wrapper documentation as the behavior authority for the installed environment version:
reset(seed=...)seeds once,stepreturnsterminatedandtruncated, and vector environments autoreset on the next step by default. Test observation, reward, terminated, truncated and info fields at the boundary. - Deep-ML - Tabular Prediction and Control ProblemsDeep-ML · support
Use named problems as closed-book checks after your own implementation passes: 272 (first-visit Monte Carlo), 257 (TD error), 273 (n-step TD), 175 (SARSA), 476 (Expected SARSA), 133 (Q-learning) and 518 (cliff walking, SARSA versus Q-learning). Read each problem's tests before trusting its statement.
- Reinforcement Learning Control Laboratory - Tabular ControlRoadmap-Final · required
Complete the MC, SARSA and Q-learning requirements with exact trajectory updates, stochastic and exploration-sensitive environments, visitation logs, matched interaction budgets and seeded alignment and bootstrap defects.
- Reinforcement Learning: An Introduction (2nd ed.) - Starred Sections 5.8 and 5.9 and Chapter 10 Sections 10.3 to 10.5Richard Sutton and Andrew Barto · support
Study starred Section 5.9 on per-decision importance sampling only for the per-decision estimator, and Chapter 10 Sections 10.3 to 10.5 on average reward and differential values only for the continuing-task unit. Cite printed pages; the authors post the full text free at incompleteideas.net.