AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation
N-Step Learning
Uses the real rewards from n steps ahead, then bootstraps.
The idea
The n-step return adds up n actual rewards and then the estimated value of the state n steps later. With n = 1 it is TD; with n as large as the episode it is Monte Carlo. Intermediate n often learns fastest, balancing bias and variance.
Gₜ:ₜ₊ₙ = Σ γᵏ rₜ₊ₖ₊₁ + γⁿ V(sₜ₊ₙ)
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- positive value
- negative value
- agent
3-step TD: wait 3 steps, add up the real rewards, then bootstrap from the value 3 steps ahead.
- episode:
- 1
1/78
The agent wanders randomly; we are only measuring how good each cell is.
Step by step
- 1Collect n steps of experience.
- 2Compute G = r₁ + γr₂ + … + γⁿ⁻¹rₙ + γⁿ V(sₙ).
- 3Update V(s₀) toward G.
- 4Slide the window forward and repeat.
Where it is used
A simple speed-up used in A3C and Rainbow.
Watch out for
Off-policy use needs corrections.