PythiloLesson 4 of 12 · progress kept in this browser

Practice in Lab: Audit a clipped inverse-propensity estimate →

Audit a clipped inverse-propensity estimate

Offline policy evaluation depends on the probability with which the logging policy chose the observed action. Rarely logged actions can create large importance weights and unstable estimates. Clipping limits variance while introducing bias; the effective sample size reports weight concentration rather than the number of independent users. Only the logged action is represented in each row. This fixture assumes correct propensities and overlap and does not recover rewards for actions never explored. Keep clipped IPS separate from a self-normalized estimator.

weights = [1., 4.]
rewards = [1., 0.]
print(sum(w*r for w,r in zip(weights,rewards))/len(rewards))
print(sum(weights)**2/sum(w*w for w in weights))
Your task

Events are [reward, logging_probability, target_probability]. Return value=mean(reward*min(target/logging,clip)), mean_weight, and ESS=(sum weights)**2/sum squared weights (zero if all weights vanish). This is clipped IPS, not self-normalized IPS. Require nonempty finite events, logging probabilities in (0,1], target probabilities in [0,1], and positive finite clip.