Why Change Measure?
A model is often trained using observations from one population but assessed for use in another. Under covariate shift, the distribution of covariates changes while the conditional distribution of outcomes given covariates remains the same. The target risk is then related to the source distribution by reweighting observations according to how common their covariates are in the target population relative to the source.
This reweighting is not merely a heuristic. It is an exact change-of-measure identity, provided the target covariate distribution is absolutely continuous with respect to the source covariate distribution. That condition says, in particular, that the target cannot assign positive probability to covariate regions that are impossible under the source.
Assume the covariate and outcome spaces are standard Borel spaces, so regular conditional distributions can be used. The equality of conditional distributions is an almost-everywhere statement: conditional distributions need not be uniquely specified at covariate values having probability zero. We require agreement on the target-relevant covariate values. The target risk of a fixed measurable predictor \(h\), under a measurable loss \(\ell\), is
The source risk \(R_P(h)\) is defined by replacing \(Q\) with \(P\). The covariate importance weight is the Radon–Nikodym derivative
which exists when \(Q_X\ll P_X\). This notation means that \(Q_X(A)=\int_A w(x)\,P_X(dx)\) for every measurable covariate set \(A\). The derivative is defined \(P_X\)-almost everywhere; its values on a \(P_X\)-null set do not affect source expectations.
The Change-of-Measure Identity
The key result expresses target risk using source-distributed observations. The weight is a function of \(X\), not of \(Y\): conditional outcome invariance is what permits the outcome part of the target expectation to be represented using source outcomes.
Proof. Let \(K_P(x,dy)\) and \(K_Q(x,dy)\) be regular conditional distributions for \(Y\) given \(X=x\) under \(P\) and \(Q\). By conditional invariance, they agree \(Q_X\)-almost everywhere. For nonnegative measurable \(g\), Tonelli's theorem gives
The second equality uses both the agreement of the conditional distributions on target-relevant covariate values and the Radon–Nikodym identity for \(Q_X\) relative to \(P_X\). Values where the conditional distributions might disagree but \(Q_X\) assigns zero probability contribute nothing to the target integral; they also contribute nothing to the weighted source integral. This proves the nonnegative case, including the possibility of an infinite expectation. For a signed loss with finite target absolute expectation, apply the nonnegative identity to its positive and negative parts. The weighted source absolute expectation is then finite and both parts can be subtracted. \(\square\)
Equivalently, under these assumptions the joint target distribution is absolutely continuous with respect to the joint source distribution, with density \(dQ/dP=w(X)\), up to \(P\)-almost-everywhere equality. To see the meaning of this statement, the theorem applies to the indicator of any measurable set of \((x,y)\) values. Thus the target probability of that set is its source expectation weighted by \(w(X)\). The joint density ratio depends only on the covariates because the conditional outcome laws are shared.
Worked Calculations
Worked Example: Discrete Covariates and a Binary Outcome
Suppose \(X\) takes values \(0,1,2\). The source probabilities are \(P_X=(0.5,0.3,0.2)\), and the target probabilities are \(Q_X=(0.2,0.5,0.3)\), listed in that order. Under both distributions, \(Y\mid X=x\) is Bernoulli with success probabilities \(0.2,0.6,0.9\), respectively. Use the predictor \(h(x)=0\) and squared-error loss \(\ell(h(x),Y)=(h(x)-Y)^2\).
Because \(Y\) is binary and \(h(x)=0\), the loss is \(Y^2=Y\). Its conditional expectation given \(X=x\) is therefore the listed Bernoulli success probability. All source covariate probabilities are positive, so \(Q_X\ll P_X\). The weights are
Directly under the target distribution, the risk is
Under the source distribution, the importance-weighted risk is
The two calculations agree. In particular, the source observations at \(X=1\) receive more weight because that covariate value is more common in the target population.
Worked Example: A Normal Covariate Shift
Let \(P_X=N(0,1)\) and \(Q_X=N(1,1)\). Under both joint distributions, let \(Y=0\) with probability one. Take \(h(x)=\mathbf{1}\{x>0\}\) and squared-error loss. The loss is then \(\mathbf{1}\{X>0\}\), so the source and target risks are the probabilities that \(X>0\) under their respective covariate distributions.
Writing \(\phi\) for the standard normal density, the source and target densities are \(\phi(x)\) and \(\phi(x-1)\). Their ratio is
The target risk, using the target distribution directly, is \(Q_X(X>0)=\Phi(1)\), where \(\Phi\) is the standard normal distribution function. The weighted source calculation gives the same value:
The equality of the conditional outcome laws holds because \(Y=0\) under both distributions. The target normal distribution has a density wherever the source normal density is positive, so the required absolute continuity also holds.
Worked Example: What Fails Without Absolute Continuity
Let \(X\) be binary. Under the source, \(P_X(X=0)=1\). Under the target, \(Q_X(X=0)=Q_X(X=1)=0.5\). Define \(Y=X\) under both distributions, and use \(h(x)=0\) with squared-error loss.
The conditional outcome rule is the same: at either covariate value, \(Y\) is deterministically equal to \(X\). But \(Q_X\not\ll P_X\), since \(P_X(\{1\})=0\) while \(Q_X(\{1\})=0.5\). The target risk is
Every source observation has \(X=0\) and \(Y=0\), so \(w(X)Y^2=0\) under the source for any finite weight defined on the observed source support. Its source expectation is zero, not \(0.5\). The target risk includes loss at a covariate value the source never observes, and no source reweighting can recover that contribution.
Why Absolute Continuity Is Essential
The condition \(Q_X\ll P_X\) is often called a support or overlap requirement in this setting. Its precise measure-theoretic meaning is that every source-null covariate set is also target-null. It is the condition that makes the covariate density ratio exist and ensures that source observations can represent all target-relevant covariate regions.
There is also a useful necessity statement. If a target expectation of every nonnegative covariate function \(a(X)\) is to be represented as \(E_P[v(X)a(X)]\) for some measurable weight \(v\), then \(Q_X\) must be absolutely continuous with respect to \(P_X\). Indeed, if \(P_X(A)=0\), then
Thus \(Q_X\ll P_X\) is not just a convenient sufficient assumption for the density-ratio formula. Without it, a source-weight representation for all target-relevant functions cannot hold. Conditional invariance is a separate requirement: absolute continuity alone does not make the source conditional outcome distribution equal to the target conditional outcome distribution.
Common Mistakes
- Reversing the ratio. To express target expectation as a source expectation, use \(dQ_X/dP_X\), not \(dP_X/dQ_X\). The discrete example verifies the direction: the target probabilities are recovered by multiplying source probabilities by \(Q_X(x)/P_X(x)\).
- Checking only the density ratio. A ratio may exist even when the conditional outcome laws differ. The identity for target risk also requires conditional outcome invariance on target-relevant covariate values.
- Treating a zero source probability as a very large weight. If a target region has positive probability but the source assigns it probability zero, there is no finite density ratio there. This is a failure of absolute continuity, not a numerical problem that the identity resolves.
- Assuming every loss expectation is finite automatically. For nonnegative losses the identity remains valid with infinite expectations. For signed losses, integrability is needed to subtract positive and negative parts safely.
Check Your Understanding
Use the assumptions and identity above to answer the following questions.
- In the discrete example, verify that the source expectation of the importance weight alone is one.
- Why does equality of conditional outcome laws need to hold on target-relevant covariate values, rather than merely on the most common source values?
- For a nonnegative loss, what does the change-of-measure theorem say if the target risk is infinite?
- State the meaning of \(Q_X\ll P_X\) using an arbitrary measurable covariate set \(A\).
- Can the target-risk identity be inferred from absolute continuity if the source and target conditional outcome distributions differ? Explain.