Why Importance-Weighted Risk Can Be Noisy
Under covariate shift, observations come from a source distribution, but performance is assessed under a target distribution. Importance weighting expresses the target risk as an expectation under the source distribution. This identity makes a source sample useful for estimating target performance, but it does not guarantee that the estimate is precise: a few observations can receive very large weights and dominate the average.
This tutorial quantifies that variability. We first bound deviations when both the loss and the weights are bounded, then give a finite-sample bound under a finite moment condition that permits unbounded weights. In both cases, the key quantities are the variability and tail behavior of the weighted loss, not just the sample size.
The equality defining \(R_Q\) uses the covariate-shift condition: the conditional distribution of \(Y\) given \(X\) is the same under source and target. The density ratio changes the distribution of \(X\), while the loss remains evaluated on each observed pair. Since the observations are independent and the weighted loss has expectation \(R_Q\), \(\widehat R_w\) is unbiased. Concentration asks how far this random average can be from that expectation.
Bounded Weights: A Bernstein Bound
Suppose \(w(X)\leq W\) with probability one. Then the summands \(U_i=w(X_i)\ell(Z_i)\) lie in \([0,BW]\). Let \(v=\operatorname{Var}_P(w(X)\ell(Z))\). Bernstein's inequality gives a deviation bound in terms of both this variance and the maximum possible summand.
Here is a derivation from the exponential-moment argument for Bernstein's inequality. If \(V\) is centered, \(|V|\leq M\), and \(E[V^2]=v\), then, for \(0<\lambda<3/M\), expansion of the exponential and the bounds \(E|V|^k\leq M^{k-2}v\) and \(k!\geq2\cdot3^{k-2}\), for \(k\geq2\), give
For independent centered summands with this bound, multiply their moment-generating-function bounds and apply Markov's inequality to their sum. Choosing \(\lambda=t/(nv+Mt/3)\) yields
Apply this inequality to \(V_i=U_i-E[U_i]\). Since \(U_i\in[0,BW]\), we have \(|V_i|\leq BW\). Setting the right-hand side to \(\delta\) and solving the resulting quadratic inequality gives \(t=\sqrt{2nv\log(2/\delta)}+(2/3)BW\log(2/\delta)\) as a valid threshold. Dividing by \(n\) proves the stated bound. Finally, \(v\leq E[U_i^2]\leq B^2E[w^2]\), as claimed. \(\square\)
Worked Example: A Bounded-Weight Risk Bound
Suppose \(P(w=0.5)=P(w=1.5)=0.5\), and the loss is \(0.2\) when \(w=0.5\) and \(0.8\) when \(w=1.5\). The weights have mean \(0.5(0.5)+0.5(1.5)=1\), as a density ratio must. The weighted losses are \(0.1\) and \(1.2\), so
Their variance is
Take \(n=100\), \(\delta=0.05\), \(B=1\), and \(W=1.5\). Since \(\log(2/\delta)=\log(40)\approx3.689\), the square-root term is \(\sqrt{2(0.3025)(3.689)/100}\approx0.149\), and the linear term is \(2(1.5)(3.689)/(3(100))\approx0.037\). Thus the theorem guarantees \(|\widehat R_w-0.65|\leq0.186\) with probability at least \(0.95\). This is a finite-sample guarantee, not a prediction that the error will equal the bound.
Finite Moments: A Bound Without Bounded Weights
A uniform upper bound on \(w\) may be unrealistic. A weaker condition still gives a finite-sample guarantee: assume \(E_P[w^q]<\infty\) for some \(q\) with \(1<q\leq2\). This permits weights with heavy tails, although the resulting probability bound generally decays more slowly than a Bernstein bound.
To justify the bound, put \(U_i=w(X_i)\ell(Z_i)\) and \(V_i=U_i-E[U_i]\). For \(1<q\leq2\), independent centered variables satisfy
One way to obtain this inequality is to introduce independent copies \(V_i'\). Conditional Jensen's inequality bounds the left side by \(E|\sum_i(V_i-V_i')|^q\). The differences are independent and symmetric. Conditional on their magnitudes, randomizing their signs and applying Jensen's inequality gives \(E_\epsilon|\sum_i\epsilon_i a_i|^q\leq(\sum_i a_i^2)^{q/2}\leq\sum_i|a_i|^q\), where the last inequality uses \(q/2\leq1\). Finally, \(E|V_i-V_i'|^q\leq2^{q-1}(E|V_i|^q+E|V_i'|^q)=2^qE|V_i|^q\), proving the displayed inequality.
A second application of \(|a-b|^q\leq2^{q-1}(|a|^q+|b|^q)\), together with Jensen's inequality, gives \(E|V_i|^q\leq2^qE|U_i|^q\). Because \(0\leq\ell\leq B\), \(E|U_i|^q\leq B^qE[w^q]\). Therefore
Markov's inequality applied to \(|\widehat R_w-R_Q|^q\) proves the probability bound. Solving that bound for \(\varepsilon\) proves the confidence statement. \(\square\)
Worked Example: Pareto Weights With a Finite Moment
Let \(T\) have a Pareto distribution with \(P(T>t)=t^{-3/2}\) for \(t\geq1\), and set \(w=T/3\). The Pareto mean is \(E[T]=(3/2)/(3/2-1)=3\), so \(E[w]=1\). For \(1<q<3/2\), integration of the Pareto density gives
Take \(q=5/4\). Then \(E[w^{5/4}]=6/3^{5/4}\), which is finite, even though the weight distribution has a heavy tail. For a loss bounded by \(B=1\), the theorem gives
The rate in the denominator is \(n^{1/4}\), rather than the \(n^{1/2}\) scale associated with a finite-variance deviation bound. This illustrates the cost of having only a \(5/4\)-moment available. The inequality can be numerically loose, especially for small \(\varepsilon\); its role is to give a valid guarantee under the stated moment assumption, not to promise a sharp numerical approximation.
Weight Variability and Effective Sample Size
Since \(E[w]=1\), the second moment \(E[w^2]\) measures variability around the average weight. By \(E[w^2]=1+\operatorname{Var}(w)\), it is at least one, with equality only when \(w=1\) almost surely. The variance part of the bounded-weight result is at most \(B^2E[w^2]/n\). Thus, all else equal, greater weight variability can increase the scale of the estimation error.
Worked Example: Weight Variability and Effective Sample Size
Suppose weights equal \(0.2\) or \(1.8\), each with source probability \(1/2\). Their mean is \(0.5(0.2)+0.5(1.8)=1\), and
For \(n=100\), the population effective sample size is \(100/1.64\approx61\). By comparison, constant weights \(w=1\) give \(E[w^2]=1\) and effective sample size \(100\). The weighted sample still contains 100 observations, but unequal weights make its average behave, in this particular weight-variability summary, more like an average based on fewer equally weighted observations. Actual risk precision also depends on how the losses vary and relate to the weights.
Interpretation and a Common Pitfall
The bounds explain why unbiasedness alone is not enough. A weighted average can target the correct risk in expectation and still vary substantially across source samples. A bounded-weight Bernstein bound gives both a variance-sensitive term and a finite-sample range term; a finite-moment bound remains available when weights are unbounded, but its guarantee weakens as the available moment order decreases.
- Pitfall: treating \(n_{\mathrm{eff}}\) as an exact sample size. It is tempting to replace \(n\) by \(\widehat n_{\mathrm{eff}}\) in an ordinary unweighted confidence interval and assume that the result is guaranteed. That conclusion does not follow from the definition. The effective sample size summarizes weight concentration; a valid risk bound also needs assumptions about the loss, weights, dependence, and tail behavior, as well as a concentration argument.
- Pitfall: assuming a finite mean guarantees concentration. \(E[w]=1\) ensures the importance weights are normalized, but it does not ensure a finite variance or a strong deviation bound. The finite-moment result requires \(E[w^q]<\infty\) for some \(q>1\); without such additional control, the stated rate does not apply.
- Pitfall: applying these results to a normalized ratio without checking. The estimator here is the unnormalized average \(n^{-1}\sum_iw_i\ell_i\), whose expectation is the target risk. Dividing by the observed sum of weights produces a different, random-denominator estimator; the bounds above do not automatically apply to it.
Check Your Understanding
Use the definitions and bounds above to answer the following.
- Why is the unnormalized importance-weighted empirical risk unbiased for the target risk under the stated covariate-shift conditions?
- In the bounded-weight theorem, what roles do the variance term and the maximum-weight term play?
- For weights with mean one, show that \(E[w^2]=1+\operatorname{Var}(w)\), and explain what this implies for population effective sample size.
- Why does the finite-moment bound require \(q>1\), and what happens to its dependence on \(n\) as \(q\) approaches one?
- Why does an empirical effective sample size alone not certify a confidence interval for weighted risk?