Four episodes are generated by a behaviour policy b. For a target policy π, the importance ratios ρ=∏tπ(at∣st)/b(at∣st) and the returns G are (ρ,G)=(4,8), (0,5), (2,3) and (4,2). Compute the ordinary and weighted importance-sampling estimates of Vπ at the start state. Which is biased, and which has higher variance?

Reinforcement learning, On-policy and off-policy
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can apply the two importance-sampling estimators and explain the bias–variance difference between them.

Key idea

Ordinary IS averages ρiGi over the N episodes. Weighted IS divides by the sum of ratios, ∑iρiGi/∑iρi. Ordinary IS is unbiased but can have huge or even infinite variance. Weighted IS is biased (the bias goes to 0 as N grows) but has much lower variance.

Steps

  1. Explain the ratio. An episode that π would produce more often than b gets ρ>1, and one that π would never produce gets ρ=0.
  2. Ordinary IS: 14(4×8+0×5+2×3+4×2)=32+0+6+84=11.5.
  3. Weighted IS: 32+0+6+84+0+2+4=4610=4.6.
  4. Sanity check. All observed returns lie between 2 and 8, and weighted IS gives 4.6, inside that range because it is a weighted average of returns. Ordinary IS gives 11.5, which is larger than any return observed.
  5. Bias. With one episode, weighted IS equals G exactly, which is the return of b's episode, not Eπ[G]. So it is biased, but it is consistent, since the bias vanishes as N→∞.
  6. Variance. Ordinary IS multiplies returns by ratios that can be very large for long episodes, since ρ is a product over time steps. Weighted IS normalises them, so each estimate stays within the range of returns.

Common mistakes

How long your answer should be

Half a page; 4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: A Markov reward process has two states with transition matrix P=(010.50.5), expected rewards R=(0,1)⊤ and γ=0.5. What is the Bellman equation in matrix form, what is its solution for V, and why does a unique solution exist for any γ<1?
Next in Reinforcement learning: A tabular value function is V=0 for states A, B, C. One episode goes A → B → C → end with rewards 0,0,1. Use TD(λ) with accumulating traces, γ=0.9, λ=0.8 and α=0.1, and update every state at every step. What is V after the episode? How does this differ from TD(0)?