From Empirical Risk to a Convex Program
A distributionally robust predictor is assessed not only under the empirical distribution of the observed sample, but under the most unfavorable distribution in a specified ambiguity set. In the finite-sample formulation, that alternative distribution assigns probability weights to the observed cases. The resulting optimization has two distinct tasks: for a fixed predictor, find its worst-case weighted loss; then choose a predictor that minimizes this worst-case risk.
Let \(Z_1,\ldots,Z_n\) be observed cases, let \(\beta\) belong to a convex set \(B\), and let \(\ell(\beta;Z_i)\) be the loss on case \(i\). Assume throughout that each loss is finite and convex in \(\beta\). Write \(p_i=1/n\) for the empirical weights. An ambiguity set \(Q\) consists of admissible probability vectors \(q=(q_1,\ldots,q_n)\).
The probability weights reallocate mass among the observed cases; they do not create new feature values or outcomes. The choice of \(Q\) expresses which reweightings are considered plausible. It may be the full simplex, a simplex with additional linear restrictions, or a divergence neighborhood around \(p\).
Simplex and Polyhedral Ambiguity Sets
For the full simplex, the worst-case distribution puts all probability on a case with the largest loss. This is a valid but often highly conservative criterion. Restrictions such as upper bounds on individual weights can prevent complete concentration. More generally, a polyhedral ambiguity set has finitely many extreme points, so the inner maximization can be represented by finitely many linear programs evaluated at those points.
Proof. For fixed \(\beta\), the objective \(q\mapsto\sum_iq_i\ell(\beta;Z_i)\) is linear. A linear function on a nonempty compact polytope attains its maximum at a vertex, giving the stated maximum. For each vertex, \(\sum_i v_i^{(k)}\ell(\beta;Z_i)\) is a nonnegative weighted sum of convex functions, hence is convex. The pointwise maximum of finitely many convex functions is convex. Finally, \(t\) is at least every vertex objective exactly when it is at least their maximum, so minimizing \(t\) gives the robust problem. \(\square\)
The epigraph representation is a convex program when \(B\) is convex. Importantly, this does not mean that the expression \(\sum_iq_i\ell(\beta;Z_i)\) is jointly convex in \((q,\beta)\). The weights and loss values are multiplied. For a finite polytope, convexity follows instead from taking the maximum over its vertices and using the epigraph constraints.
Worked Example: A Weight-Capped Simplex
At a fixed predictor, suppose the three observed losses are \(0,2,5\), and let \(Q=\{q:q_i\geq0,\ \sum_iq_i=1,\ q_i\leq 1/2\}\). Find the worst-case risk.
The largest loss is \(5\), so a maximizing weight vector should assign as much mass as allowed to case 3: \(q_3=1/2\). The remaining mass is \(1/2\). It is best assigned to the next-largest loss, giving \(q_2=1/2\) and \(q_1=0\). The resulting risk is \(\sum_iq_i\ell_i=(0)(0)+(1/2)(2)+(1/2)(5)=3.5\).
No feasible vector can do better: at most \(1/2\) of the mass can receive loss \(5\), and the remaining mass receives loss at most \(2\). Thus every feasible risk is at most \((1/2)(5)+(1/2)(2)=3.5\), attained by the weights above.
Divergence Constraints and a Convex Prediction Objective
A divergence ball limits how far the weights can move from the empirical distribution. One common choice is relative entropy, or Kullback–Leibler divergence: \(D_{\mathrm{KL}}(q\Vert p)=\sum_iq_i\log(q_i/p_i)\), with \(0\log(0/p_i)=0\). For \(p_i>0\), the ambiguity set \(Q_\rho=\{q:q_i\geq0,\sum_iq_i=1,D_{\mathrm{KL}}(q\Vert p)\leq\rho\}\) is convex. For \(\rho>0\), the worst-case risk admits a useful dual expression.
Proof. For any \(\eta>0\), set \(C=\sum_i p_i\exp(a_i/\eta)\) and \(r_i=p_i\exp(a_i/\eta)/C\). These \(r_i\) are positive and sum to one. For any probability vector \(q\), \(\sum_iq_i a_i-\eta D_{\mathrm{KL}}(q\Vert p) =\eta\log C-\eta D_{\mathrm{KL}}(q\Vert r)\). Relative entropy is nonnegative, so for any \(q\in Q_\rho\), \(\sum_iq_i a_i\leq\eta\rho+\eta\log C\). Taking the supremum over \(q\), then the infimum over \(\eta>0\), proves one inequality.
For the reverse inequality, maximize the linear objective over the probability simplex subject to the convex constraint \(D_{\mathrm{KL}}(q\Vert p)\leq\rho\). The feasible set is compact, and \(q=p\) is strictly feasible because \(D_{\mathrm{KL}}(p\Vert p)=0<\rho\). Strong Lagrange duality therefore applies. For multiplier \(\eta\geq0\), the dual objective is \(\eta\rho+\sup_q\{\sum_iq_i a_i-\eta D_{\mathrm{KL}}(q\Vert p)\}\). For \(\eta>0\), the identity already shown, maximized over \(q\), gives \(\eta\rho+\eta\log C\); equality in that maximization occurs at \(q=r\). The dual infimum gives the claimed expression, with a possible boundary value at \(\eta=0\) understood as a limit from \(\eta>0\). Thus the infimum over positive \(\eta\) equals the strong-duality value.
To see convexity, write \(g(\eta,a)=\eta\log(\sum_i p_i\exp(a_i/\eta))\). This is the perspective of the convex log-sum-exp function, hence convex jointly in \((\eta,a)\) for \(\eta>0\). It is also nondecreasing in each \(a_i\). Substituting the convex functions \(a_i=\ell(\beta;Z_i)\) therefore preserves convexity; adding the linear term \(\eta\rho\) does as well. The infimum formulation is an optimization over the joint variables \((\beta,\eta)\), so it supplies a convex formulation of the robust prediction problem. \(\square\)
Worked Example: Relative-Entropy Weights for Squared Loss
Take two equally weighted observations, with responses \(0\) and \(2\), and predictor \(\beta\in\mathbb R\). The squared losses are \(\ell_1(\beta)=\beta^2\) and \(\ell_2(\beta)=(\beta-2)^2\). Set \(\rho=\tfrac34\log(3/2)+\tfrac14\log(1/2)\), which is approximately \(0.1308\). Evaluate the worst-case risk at \(\beta=1/2\).
At this predictor the losses are \(\ell_1=1/4\) and \(\ell_2=9/4\). The weight vector \(q=(1/4,3/4)\) is feasible because \(D_{\mathrm{KL}}(q\Vert p)=\tfrac14\log((1/4)/(1/2))+\tfrac34\log((3/4)/(1/2))=\tfrac14\log(1/2)+\tfrac34\log(3/2)=\rho\). Its weighted loss is \((1/4)(1/4)+(3/4)(9/4)=7/4=1.75\).
It is also worst-case. For these two losses, the objective increases with \(q_2\). The binary relative entropy \(q_2\log(2q_2)+(1-q_2)\log(2(1-q_2))\) increases for \(q_2>1/2\), and the stated radius is its value at \(q_2=3/4\). Thus no feasible weight has \(q_2>3/4\), and the maximum is attained at \(q=(1/4,3/4)\). For prediction over all \(\beta\), the same example has a convex robust objective: the relative-entropy dual theorem applies because both squared losses are convex.
Moment Constraints
Moment restrictions constrain weighted averages of known case-level quantities. Let \(z_i\in\mathbb R^d\) be specified vectors and let \(m\in\mathbb R^d\) be a target moment. The ambiguity set \(Q_m=\{q:q_i\geq0,\sum_iq_i=1,\sum_iq_i z_i=m\}\) is a polytope whenever it is nonempty. Its worst-case risk is a linear program for fixed losses. In particular, its dual form is \(\min_{\alpha\in\mathbb R,\lambda\in\mathbb R^d}\alpha+\lambda^\mathsf{T}m\), subject to \(\alpha+\lambda^\mathsf{T}z_i\geq\ell(\beta;Z_i)\) for each \(i\). This follows from the linear-programming dual: \(\alpha,\lambda\) are multipliers for the total-mass and moment equalities, and the inequalities are the dual constraints for \(q_i\geq0\). When the primal is feasible and bounded, strong linear-programming duality gives equality. The dual constraints are convex in \(\beta\) for convex losses, so they also give a convex prediction formulation.
Worked Example: An Exact Moment Restriction
Suppose three cases have moment values \(z_1=-1,z_2=0,z_3=1\), and the required weighted mean is \(m=0\). At a fixed predictor, let the losses be \(4,1,0\). Find the worst-case weights and risk.
The constraints are \(q_1+q_2+q_3=1\) and \(-q_1+q_3=0\), so \(q_1=q_3=a\) and \(q_2=1-2a\). Nonnegativity requires \(0\leq a\leq1/2\). The weighted loss is \(4q_1+q_2+0q_3=4a+(1-2a)=1+2a\). This increases over the feasible interval, so it is maximized at \(a=1/2\). The worst-case weights are \((1/2,0,1/2)\), and the risk is \(2\).
For a convex-loss prediction problem, the same moment constraints remain linear in \(q\), while the dual inequalities \(\alpha+\lambda z_i\geq\ell(\beta;Z_i)\) are convex in \(\beta\). The example’s numerical losses illustrate the inner optimization at one predictor; they need not themselves be linear in the predictor.
Formulation Checks and a Common Pitfall
The main modeling question is what information the ambiguity set is intended to preserve. A simplex alone permits arbitrary concentration; a divergence ball controls departure from a reference distribution; moment equalities preserve specified weighted averages. Constraints can also be combined, provided their intersection is nonempty. Once the set is chosen, check that its weights are nonnegative and sum to one, and that every additional restriction is imposed on the intended case-level quantities.
- Pitfall: minimizing jointly over the predictor and the adversarial weights. The expression \(\sum_iq_i\ell(\beta;Z_i)\) is generally not jointly convex, since it multiplies a weight by a loss depending on \(\beta\). Simply writing \(\min_{\beta,q}\sum_iq_i\ell(\beta;Z_i)\) is also the wrong order: it lets the predictor select favorable weights.
- Correction: The robust objective is \(\min_\beta\sup_{q\in Q}\sum_iq_i\ell(\beta;Z_i)\). Use a finite-vertex epigraph for a polytope, or a valid dual representation such as the relative-entropy formula. These formulations preserve the worst-case order and expose convexity under the stated conditions.
- Pitfall: treating a moment equality as a penalty. Replacing \(\sum_iq_i z_i=m\) by a term in the objective changes the ambiguity set and generally changes the worst-case risk. Use an equality when the moment must be preserved exactly.
Check Your Understanding
Use the definitions and formulations above to answer these questions.
- Why does a linear inner objective over a compact polytope attain its maximum at a vertex?
- For a full-simplex ambiguity set, what is the worst-case risk at a fixed predictor in terms of the observed losses?
- In the relative-entropy formulation, what role does the scalar \(\eta\) play, and why is the perspective expression convex?
- For moment values \((-1,0,1)\) and target mean zero, describe all feasible probability weights.
- Explain why jointly minimizing the weighted loss over both \(q\) and \(\beta\) does not in general represent distributionally robust prediction.