Sam Babichenko

Reading notes / Missing and selective labels

Doubly robust policy evaluation

Dudík et al., 2011; Swaminathan and Joachims, 2015

Context. A deployed policy picks one action per context and sees only that action's reward, and the questions are how a different policy would have done and which policy to deploy. The direct method (DM) averages a reward model's prediction for the new policy's action, and is biased wherever the model is wrong, typically where the new policy differs from the old. Inverse propensity scoring (IPS) reweights each logged reward by the inverse probability that the old policy took that action; it is unbiased with correct propensities, and its variance grows with their inverses. Dudík et al. bring doubly robust (DR) estimation, from survey sampling and missing data (Robins et al., 1994), to policy evaluation, with a finite-sample analysis that assumes neither model is correct; Swaminathan and Joachims turn a uniform empirical Bernstein bound into a learning rule. DR uses the reward model as a control variate and importance-weights only its residual, so the bias is the product of the two models' errors and the variance inflation from small propensities multiplies the squared residual instead of the squared reward. When choosing among many policies, penalize each by the standard deviation of its own importance-weighted losses, which keeps the learned policy where the logs can measure it. Both divide by the propensities, so they should be logged, and both need some exploration kept.

Setting. There are kk actions. The world draws (x,r⃗)(x,\vec r) with r⃗∈[0,1]k\vec r\in[0,1]^k, the logging policy draws a∼p(a∣x,h)a\sim p(a\mid x,h), where hh is the history so far (so logging may be adaptive and randomized), and only rar_a is revealed. The target is a deterministic policy π\pi with value Vπ=E[rπ(x)]V^\pi=\mathbb E[r_{\pi(x)}]. Write ϱa(x)=E[ra∣x]\varrho_a(x)=\mathbb E[r_a\mid x], and let a reward model ϱ^a(x)\hat\varrho_a(x) and a propensity model p^(a∣x,h)\hat p(a\mid x,h) be fit on data independent of the evaluation sample SS. The three estimators areV^DM=1∣S∣∑x∈Sϱ^π(x)(x),V^IPS=1∣S∣∑Sra 1{π(x)=a}p^(a∣x,h),V^DR=1∣S∣∑S[(ra−ϱ^a(x)) 1{π(x)=a}p^(a∣x,h)+ϱ^π(x)(x)].\hat V_{\rm DM}=\frac1{|S|}\sum_{x\in S}\hat\varrho_{\pi(x)}(x),\qquad \hat V_{\rm IPS}=\frac1{|S|}\sum_{S}\frac{r_a\,\mathbf 1\{\pi(x)=a\}}{\hat p(a\mid x,h)},\qquad \hat V_{\rm DR}=\frac1{|S|}\sum_{S}\Big[\frac{(r_a-\hat\varrho_a(x))\,\mathbf 1\{\pi(x)=a\}}{\hat p(a\mid x,h)}+\hat\varrho_{\pi(x)}(x)\Big].The reward-model error is measured additively and the propensity error multiplicatively, Δ=ϱ^a(x)−ϱa(x)\Delta=\hat\varrho_a(x)-\varrho_a(x) and δ=1−p(a∣x,h)/p^(a∣x,h)\delta=1-p(a\mid x,h)/\hat p(a\mid x,h), both at a=π(x)a=\pi(x).

Step 1

The bias of DR is the product of the two errors. Add and subtract the true mean reward in one summand. With I=1{π(x)=a}I=\mathbf 1\{\pi(x)=a\},(ra−ϱ^a)Ip^+ϱ^π(x)=(ra−ϱa)Ip^⏟ε+ϱπ(x)+Δ(1−Ip^).\frac{(r_a-\hat\varrho_a)I}{\hat p}+\hat\varrho_{\pi(x)}=\underbrace{\frac{(r_a-\varrho_a)I}{\hat p}}_{\varepsilon}+\varrho_{\pi(x)}+\Delta\Big(1-\frac{I}{\hat p}\Big).The noise ε\varepsilon has mean zero given (x,a)(x,a), and E[I∣x,h]=p\mathbb E[I\mid x,h]=p, so the last piece has mean Δδ\Delta\delta: the model error is added outside the correction and removed inside it, up to the propensity error. Hence the bias is ∣E[Δδ]∣|\mathbb E[\Delta\delta]| (Theorem 1), against ∣ExΔ∣|\mathbb E_x\Delta| for DM and ∣Ex[ϱπ(x)δ]∣|\mathbb E_x[\varrho_{\pi(x)}\delta]| for IPS, which are special cases of the same formula (IPS is ϱ^≡0\hat\varrho\equiv0, DM drops the correction). DR is unbiased if either model is right and nearly unbiased if either is nearly right, though no estimator dominates in general. The formula also covers missing overlap: where the logger never takes π(x)\pi(x), the correction never fires, δ=1\delta=1 whatever p^\hat p is, and DR is the direct method there, carrying the full model error.

Step 2

In the variance, the inverse-propensity factor multiplies only the squared residual. Square the same decomposition. The cross terms with ε\varepsilon vanish, since it has conditional mean zero, and the one new ingredient is the second moment of the correction factor, with p=p(π(x)∣x)p=p(\pi(x)\mid x),E[(1−Ip^)2 ∣ x]=δ2+p(1−p)p^2=δ2+1−pp(1−δ)2.\mathbb E\Big[\Big(1-\frac I{\hat p}\Big)^2\,\Big|\,x\Big]=\delta^2+\frac{p(1-p)}{\hat p^2}=\delta^2+\frac{1-p}{p}(1-\delta)^2.Completing the square with the ϱπ(x)\varrho_{\pi(x)} term gives, for a stationary logger, Theorem 2:Var V^DR=1∣S∣(E[ε2]+Varx[ϱπ(x)+Δδ]+Ex[1−pp Δ2(1−δ)2]),\mathrm{Var}\,\hat V_{\rm DR}=\frac1{|S|}\Big(\mathbb E[\varepsilon^2]+\mathrm{Var}_x\big[\varrho_{\pi(x)}+\Delta\delta\big]+\mathbb E_x\Big[\frac{1-p}{p}\,\Delta^2(1-\delta)^2\Big]\Big),and IPS has the same expression with Δ\Delta replaced by −ϱπ(x)-\varrho_{\pi(x)} (my check: a simulation with three contexts and two actions matches both theorems to Monte Carlo error). In both, the inverse-propensity factor (1−p)/p(1-p)/p multiplies a squared error, Δ2\Delta^2 for DR and ϱπ(x)2\varrho^2_{\pi(x)} for IPS, so any reward model closer to the truth than zero helps. The reward-noise term is the same for both, E[ε2]≈Ex[σ2/p]\mathbb E[\varepsilon^2]\approx\mathbb E_x[\sigma^2/p], with σ2\sigma^2 the conditional variance of the reward, and no reward model can remove it. DM has neither term, so its error is typically almost all bias. Fitting both models on data separate from SS keeps Δ\Delta and δ\delta fixed functions.

Step 3

In evaluation, even a badly biased reward model reduces variance as a control variate. On nine UCI classification sets turned into bandits with uniform logging and known propensities, IPS and DR are unbiased, as Theorem 1 predicts, while the direct method's bias of 0.06 to 0.28 in classification error accounts for all of its rmse, and DR's rmse is below IPS's on most sets (letter 0.049 to 0.030). Under covariate shift on web-portal data, DR lowers the rmse by 13.6 percent on average, and the gain is in the variance.

Step 4

For learning, DR fills in the full loss vector and any cost-sensitive learner runs on it. Impute every action's loss by its DR estimate,l^DR(x,a′)=l^(x,a′)+(la−l^(x,a)) 1{a′=a}p(a∣x),\hat l_{\rm DR}(x,a')=\hat l(x,a')+\frac{\big(l_a-\hat l(x,a)\big)\,\mathbf 1\{a'=a\}}{p(a\mid x)},and hand the completed vectors to a full-information learner. IPS imputation is the same with l^≡0\hat l\equiv0, which leaves one inflated entry and k−1k-1 zeros per example, so every unlogged action appears to have zero loss. The gains are much larger than in evaluation: with direct loss minimization the test error on optdigits falls from 0.644 to 0.090. This part is empirical only; the theory covers evaluating a fixed policy.

Step 5

Minimizing IPS over a class picks policies whose estimates are low by chance, and a variance-sensitive bound corrects for this. Swaminathan and Joachims log (xi,yi,δi,pi)(x_i,y_i,\delta_i,p_i), with δi\delta_i the loss (unrelated to the propensity error above) of the output yiy_i the stochastic logger h0h_0 chose and pi=h0(yi∣xi)p_i=h_0(y_i\mid x_i), and estimate a stochastic policy's risk by clipped IPS, R^M(h)=1n∑iuhi\hat R^M(h)=\frac1n\sum_iu_h^i with uhi=δimin⁡{M,h(yi∣xi)/pi}u_h^i=\delta_i\min\{M,h(y_i\mid x_i)/p_i\}, clipped because the weights h/pih/p_i are unbounded and one small propensity can move the estimate arbitrarily. Unclipped, the estimate is unbiased for each hh, but its variance differs by orders of magnitude across the class, large for policies that put mass where h0h_0 rarely went, so its minimizer favors policies whose estimate is low by chance. With losses in [−1,0][-1,0] (Step 6 says why) clipping is conservative, since δmin⁡{M,w}≥δw\delta\min\{M,w\}\ge\delta w. To bound the risk uniformly, map each policy to fh=1+uh/Mf_h=1+u_h/M, a function with values in [0,1][0,1], apply Maurer and Pontil's uniform empirical Bernstein inequality over that class, and multiply back by MM (Maurer and Pontil need n≥16n\ge16). The sample variance of fhf_h is Varh(u)/M2\mathrm{Var}_h(u)/M^2, so the variance term comes out with no MM in it, and R≤RMR\le R^M finishes the proof: with probability at least 1−γ1-\gamma, for all h∈Hh\in H,R(h)≤R^M(h)+18 Varh(u) QH(n,γ)n+15 M QH(n,γ)n−1,R(h)\le\hat R^M(h)+\sqrt{\frac{18\,\mathrm{Var}_h(u)\,Q_H(n,\gamma)}{n}}+\frac{15\,M\,Q_H(n,\gamma)}{n-1},with Varh(u)\mathrm{Var}_h(u) the sample variance of the uhiu_h^i and QH(n,γ)=log⁡(10 N∞(1/n,FH,2n)/γ)Q_H(n,\gamma)=\log\big(10\,\mathcal N_\infty(1/n,\mathcal F_H,2n)/\gamma\big), with FH\mathcal F_H the class of the fhf_h. The first term is the policy's own standard deviation, which tells well-measured policies from noisy ones where Hoeffding would charge every policy M/nM/\sqrt n; MM appears as a factor only in the order-1/n1/n range term, which without clipping is unbounded unless the propensities are bounded below. The CRM principle minimizes R^M(h)+λVarh(u)/n\hat R^M(h)+\lambda\sqrt{\mathrm{Var}_h(u)/n}, an upper confidence bound; λ=0\lambda=0 is clipped IPS.

Step 6

The loss must be translated to [−1,0][-1,0], because the objective has to be an upper bound. With nonnegative losses, a policy that puts zero mass on every logged output has R^M=0\hat R^M=0 and zero variance, the best possible value, though nothing is known about its risk. A risk bound that holds without full support corrects this. For losses in [∇,△][\nabla,\triangle],Ey∼h(x)δ(x,y)≤△+Ey∼h0(x)[(δ(x,y)−△)h(y∣x)h0(y∣x)],\mathbb E_{y\sim h(x)}\delta(x,y)\le\triangle+\mathbb E_{y\sim h_0(x)}\Big[(\delta(x,y)-\triangle)\frac{h(y\mid x)}{h_0(y\mid x)}\Big],since outputs h0h_0 never produces contribute at most △\triangle times their mass. Rescaling δ↦(δ−△)/(△−∇)∈[−1,0]\delta\mapsto(\delta-\triangle)/(\triangle-\nabla)\in[-1,0] then charges mass on unlogged outputs the worst loss, and the data-avoiding policy scores 0, the worst value. For the same reason λ\lambda must stay small enough that h0h_0 itself has a negative objective, or the penalty lets the data-avoiding policy win; the experiments set MM to the ratio of the 90th to the 10th percentile propensity. Their follow-up (NeurIPS 2015) shows that the translation is not enough. The learner can still lower R^\hat R by inflating the total weight 1n∑ih(yi∣xi)/pi\frac1n\sum_ih(y_i\mid x_i)/p_i, whose expectation is 1, putting mass on logged outputs whatever their loss. They call this propensity overfitting and remove it with the self-normalized estimator ∑iδiwi/∑iwi\sum_i\delta_iw_i/\sum_iw_i, whose minimizer does not change when a constant is added to the loss.

Step 7

POEM makes the penalty trainable by SGD, and beats IPS minimization on every set. For softmax linear policies hw(y∣x)∝exp⁡(w⋅ϕ(x,y))h_w(y\mid x)\propto\exp(w\cdot\phi(x,y)) the penalty Varw(u)\sqrt{\mathrm{Var}_w(u)} is not a sum over examples; writing Varw=1n−1(∑i(uwi)2−nuˉw2)\mathrm{Var}_w=\frac1{n-1}\big(\sum_i(u_w^i)^2-n\bar u_w^2\big) and taking tangent-line bounds at the current wtw_t, v≤v0+(v−v0)/(2v0)\sqrt v\le\sqrt{v_0}+(v-v_0)/(2\sqrt{v_0}) and −uˉ2≤uˉ02−2uˉ0uˉ-\bar u^2\le\bar u_0^2-2\bar u_0\bar u, gives a surrogate linear in ∑iuwi\sum_iu^i_w and ∑i(uwi)2\sum_i(u^i_w)^2, so each epoch runs AdaGrad on per-example gradients and then re-linearizes, a majorize-minimize scheme. On four multilabel sets turned into bandit feedback by a CRF logger, POEM beats IPS minimization on every set, significantly, though two of the four gains are small (Scene 1.193 to 1.168 in Hamming loss) and TMC's is large (2.808 to 2.197). Sharpening the logger toward its argmax, w0↦αw0w_0\mapsto\alpha w_0, shrinks POEM's margin until, for α≥16\alpha\ge16, it only recovers the logger's own argmax prediction. The benefit of the variance penalty is shown only empirically, on these four sets.

Consequences and limits. Whenever a reward model is available, DR is the natural default off-policy estimator, for the cost of one regression, and a learning objective must account for how well each candidate is measured. Neither creates overlap. A deterministic approve/decline fraud policy logs outcomes only for approvals, so for transactions the old model declined and a new one would approve, DR returns the reward model's guess, with an error the logs cannot reveal, and for a deterministic logger there are examples on which any learner stays suboptimal as n→∞n\to\infty (Langford et al., 2008). A small randomized exploration rate ϵ\epsilon (approve a random fraction of would-be declines and log that probability) puts p≥ϵp\ge\epsilon there. DR is then unbiased on that region with variance scaling like (σ2+Δ2)/ϵ(\sigma^2+\Delta^2)/\epsilon, so a better fraud model makes a smaller exploration rate affordable through the Δ2\Delta^2 part, while the outcome noise σ2\sigma^2 sets a floor. For CRM the weights on that traffic are about 1/ϵ1/\epsilon, which sets the clipping level, and the variance penalty decides how far the new policy may move into that region; without exploration, CRM will not move toward it. Either way the propensities should be logged, since every estimator here divides by them; CRM cannot run without them. DR's variance theorem and CRM's bound assume a stationary logger, and CRM's covering number is never evaluated for the softmax class.

Terms

Direct method (DM)
Average the reward model's prediction for the target action; low variance, bias ExΔ\mathbb E_x\Delta.
IPS
Reweight logged rewards by 1{π(x)=a}/p^\mathbf 1\{\pi(x)=a\}/\hat p; unbiased with true propensities, variance grows like 1/p1/p.
Doubly robust (DR)
Model prediction plus an importance-weighted correction on the residual ra−ϱ^ar_a-\hat\varrho_a.
DR bias
Ex[Δδ]\mathbb E_x[\Delta\delta]: zero if either model is right, small if either is nearly right.
Importance-weighting penalty
Ex[1−ppΔ2(1−δ)2]\mathbb E_x[\frac{1-p}{p}\Delta^2(1-\delta)^2]; for IPS the same with ϱ2\varrho^2 in place of Δ2\Delta^2.
Reward-noise term
E[ε2]≈Ex[σ2/p]\mathbb E[\varepsilon^2]\approx\mathbb E_x[\sigma^2/p]; the same for DR and IPS, and no reward model reduces it.
R^M(h)\hat R^M(h)
Clipped IPS risk 1n∑iδimin⁡{M,h(yi∣xi)/pi}\frac1n\sum_i\delta_i\min\{M,h(y_i\mid x_i)/p_i\}; conservative when δ≤0\delta\le0.
CRM principle
Minimize R^M(h)+λVarh(u)/n\hat R^M(h)+\lambda\sqrt{\mathrm{Var}_h(u)/n}: the upper confidence bound, as in structural risk minimization.
Loss scaling
Translate losses to [−1,0][-1,0] so the objective upper-bounds risk and unlogged mass is charged the worst loss.
Propensity overfitting
Lowering the IPS estimate by inflating 1n∑ih/pi\frac1n\sum_ih/p_i; fixed by self-normalizing (follow-up paper).

Quiz

  1. An old approve/decline policy is deterministic. For transactions it declined and a new policy would approve, what does the DR estimator use?
  2. Which part of DR's variance can a better reward model not reduce?
  3. Each policy's IPS estimate is unbiased. Why can minimizing it over a rich class still pick a bad policy?
  4. The logger is sharpened toward its argmax, w0↦αw0w_0\mapsto\alpha w_0. What does the theory predict, and what happens in the experiment?

Sources