Off-policy MC learns about π* while following behavior policy β by reweighting episode returns using importance sampling. The weight corrects for the mismatch between behavior and target policies. For this exercise the behavior policy is uniform over the actions observed in the episode, and the target policy is greedy with respect to the mean return of each (state, action) pair seen so far (ties go to the action that appears first in the episode).
You have episodes from behavior policy β (e.g., ε-greedy). You want to estimate V^π*(s) or Q^π*(s,a) for the greedy policy. Importance sampling computes W_t = ∏(π(a_i|s_i) / β(a_i|s_i)) to reweight returns.
Implement estimate_off_policy_returns(episodes, gamma) which:
Compute ordinary importance sampling weight for each return.
No results yet
Run your code to check it against the examples, or submit to run every test.