Example 6.4 (You are the Predictor): batch TD(0) gives , batch MC gives
ProvedSuttonBartoRL.BatchTD.you_are_the_predictorp2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1reinforcement-learningtemporal-difference-learning
Consider two nonterminal states , , no discounting (), and the batch of eight episodes
Then:
- the certainty-equivalence estimate is ;
- the sample averages of the returns are and ;
- there is such that for every and every initial array , batch TD(0) converges to , and batch constant- MC converges to , .
The example shows the two batch answers differing on data from a single batch: the Monte Carlo answer fits the training returns exactly, while the TD answer is the one implied by the Markov model built from the data.
Formalization Note and are the elements and of Fin 2. The first episode is the list : from with reward to , then from with reward to the terminal state.
Preamble
import Mathlib import Definitions.Def_SuttonBartoRL_BatchTD_Episodes import Definitions.Def_SuttonBartoRL_BatchTD_BatchUpdating open Filter Topology
Formal statement
namespace SuttonBartoRL.BatchTD
/-- Example 6.4 "You are the Predictor", pp. 127–128. States `A = 0`, `B = 1` of `Fin 2`, `γ = 1`,
and the eight episodes `A,0,B,0`; `B,1` (six times); `B,0`. The certainty-equivalence estimate
is `V(A) = V(B) = 3/4`, which is what batch TD(0) converges to; the sample averages of the returns
are `V(A) = 0`, `V(B) = 3/4`, which is what batch Monte Carlo converges to. -/
theorem you_are_the_predictor :
let b : Batch (Fin 2) :=
[[((0 : Fin 2), (0 : ℝ)), (1, 0)], [(1, 1)], [(1, 1)], [(1, 1)], [(1, 1)], [(1, 1)],
[(1, 1)], [(1, 0)]]
ceEstimate 1 b 0 = 3 / 4 ∧ ceEstimate 1 b 1 = 3 / 4 ∧
mcAverage 1 b 0 = 0 ∧ mcAverage 1 b 1 = 3 / 4 ∧
∃ αbar : ℝ, 0 < αbar ∧ ∀ α : ℝ, 0 < α → α < αbar → ∀ V₀ : Fin 2 → ℝ,
Tendsto (fun m : ℕ => batchTD α 1 b V₀ m 0) atTop (𝓝 (3 / 4)) ∧
Tendsto (fun m : ℕ => batchTD α 1 b V₀ m 1) atTop (𝓝 (3 / 4)) ∧
Tendsto (fun m : ℕ => batchMC α 1 b V₀ m 0) atTop (𝓝 0) ∧
Tendsto (fun m : ℕ => batchMC α 1 b V₀ m 1) atTop (𝓝 (3 / 4)) := by sorry
end SuttonBartoRL.BatchTD
Source
Sutton & Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press (2018), ISBN 9780262039246, Example 6.4, pp. 127–128
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.