Example 5.5: ordinary importance sampling with infinite variance
ProvedSuttonBartoRL.ImportanceSampling.infinite_variance_exampleimportance-samplingmonte-carlop2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1reinforcement-learning
In the one-state MDP of Example 5.5 (from , right terminates with reward ; left returns to with probability and reward or terminates with probability and reward ), take , the target policy that always selects left and the behaviour policy that selects left and right with probability each. Then:
- the value of under the target policy is ;
- the importance-sampling-scaled return has mean one, ;
- its expected square is infinite:
Hence the ordinary importance-sampling estimator has infinite variance in this example, although its mean is finite and correct.
Formalization Note Episodes here have unbounded length. The expectations are series over episode lengths; the expected square is computed in (ℝ≥0∞), where a divergent series has the value .
Preamble
import Mathlib import Definitions.Def_SuttonBartoRL_ImportanceSampling_Episodes import Definitions.Def_SuttonBartoRL_ImportanceSampling_InfiniteVarianceExample
Formal statement
namespace SuttonBartoRL.ImportanceSampling
/-- Sutton & Barto (2018), Example 5.5 "Infinite Variance", pp. 106–108 (Figure 5.4), with `γ = 1`:
the value of `s` under the target policy (always `left`) is `1`; the importance-sampling-scaled
return `ρ_{0:T-1} G_0` of an episode from `s` under the behaviour policy (`left`/`right` with
probability `1/2`) has mean `1`; and its expected square is `+∞`. -/
theorem infinite_variance_example :
value exampleMDP exampleTerminal exampleTarget 1 ExState.s = 1 ∧
expectation exampleMDP exampleTerminal exampleBehavior ExState.s
(fun n e => e.isRatio exampleTarget exampleBehavior n * e.ret 1) = 1 ∧
∑' n : ℕ, ∑ e : Episode exampleMDP n,
ENNReal.ofReal (episodeProb exampleMDP exampleTerminal exampleBehavior ExState.s e *
(e.isRatio exampleTarget exampleBehavior n * e.ret 1) ^ 2) = ⊤ := by sorry
end SuttonBartoRL.ImportanceSampling
Source
Sutton & Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press (2018), ISBN 9780262039246, Example 5.5 'Infinite Variance', pp. 106–108, Figure 5.4
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.