Tutorials › Statistical Learning (Graduate) › Problem-Solving Workshop on Loss-Specific Aggregation

Exponential Weights and Convex Aggregation · Tutorial 345 of 989

Problem-Solving Workshop on Loss-Specific Aggregation

Work through loss-specific aggregation problems by matching the prediction rule and temperature to the guarantee its assumptions actually support.

Advanced 12 min read

What You'll Learn

  • Distinguish randomized aggregation guarantees for bounded losses from deterministic guarantees that require exp-concavity.
  • Derive the exponential-weights regret bound and choose its temperature from the loss range, sample size and prior mass.
  • Compute sequential squared-loss aggregates and verify their cumulative loss.
  • Check logistic exp-concavity on a bounded score interval and use it to justify deterministic score averaging.
  • Derive the exact sequential-mixture guarantee for log loss and calculate its prior-mass penalty.
  • Select a comparator that the chosen guarantee actually covers.

Introduction

An aggregation problem is not solved just by writing down exponential weights. The guarantee depends on what is being averaged, how the loss behaves under that averaging, how the weights are updated, and which comparator is being used. A rule valid for a randomized choice among predictors need not justify using their average prediction.

This workshop organizes those decisions around four loss settings: bounded losses, squared loss, logistic loss on a bounded score range, and log loss. The central distinction is whether the loss supports a deterministic aggregate through exp-concavity, or whether the guarantee applies to the weighted average loss of a randomized predictor.

A Decision Rule for Choosing the Guarantee

Let there be \(M\) candidate predictors, with a prior \(\pi=(\pi_1,\ldots,\pi_M)\), where \(\pi_j>0\) and \(\sum_{j=1}^M\pi_j=1\). At round \(t\), candidate \(j\) makes prediction \(f_{t,j}\), and its loss after observing the outcome is \(\ell_{t,j}\). For a temperature \(\eta>0\), define the weights before round \(t\) by

$$ w_{t,j} = \frac{\pi_j\exp\!\left(-\eta\sum_{s=1}^{t-1}\ell_{s,j}\right)} {\sum_{k=1}^M \pi_k\exp\!\left(-\eta\sum_{s=1}^{t-1}\ell_{s,k}\right)}. $$

A deterministic aggregate forms a prediction from these weights, often \(g_t=\sum_j w_{t,j}f_{t,j}\). A randomized aggregate instead draws candidate \(j\) with probability \(w_{t,j}\), so its conditional expected loss is \(\sum_jw_{t,j}\ell_{t,j}\). These are different procedures: the second equality defines expected loss for a randomized choice, not the loss of the averaged prediction.

Definition: A loss \(\ell(y,a)\) is \(\eta\)-exp-concave in the action \(a\) on a convex action set if \(a\mapsto\exp(-\eta\ell(y,a))\) is concave there for every outcome \(y\). This condition allows Jensen’s inequality to connect a deterministic weighted-average prediction to the weighted losses of its components.

The practical decision is therefore: use a deterministic aggregate when the loss is exp-concave on the full action range being used; use a bounded-loss regret guarantee for a randomized choice when only boundedness is available; and use the sequential probability mixture for log loss. The prior controls the cost of comparing with a candidate: a candidate with small prior mass has a larger penalty.

Two Guarantees and Their Assumptions

First, suppose each round’s loss is \(\eta\)-exp-concave in the prediction, the action set is convex, and the aggregate is \(g_t=\sum_jw_{t,j}f_{t,j}\). Let \(L_j=\sum_{t=1}^n\ell_{t,j}\) be candidate \(j\)’s cumulative loss. Then the deterministic aggregate satisfies

$$ \sum_{t=1}^n\ell(y_t,g_t) \leq -\frac{1}{\eta}\log\!\left(\sum_{j=1}^M\pi_j e^{-\eta L_j}\right) \leq L_j+\frac{\log(1/\pi_j)}{\eta} \quad\text{for every }j. $$

Here the candidates’ round-\(t\) losses are evaluated at their predictions for that round. The guarantee compares the aggregate with each fixed candidate, with a penalty determined by its prior mass.

To prove the result, set \(Z_t=\sum_j\pi_j\exp(-\eta\sum_{s<t}\ell_{s,j})\), so \(Z_1=1\). Exp-concavity and Jensen’s inequality give

$$ e^{-\eta\ell(y_t,g_t)} \geq \sum_jw_{t,j}e^{-\eta\ell_{t,j}} = \frac{Z_{t+1}}{Z_t}. $$

Taking logarithms and summing over \(t\) yields \(-\eta\sum_t\ell(y_t,g_t)\geq\log Z_{n+1}-\log Z_1=\log Z_{n+1}\). Since \(Z_{n+1}\geq\pi_j e^{-\eta L_j}\), taking negative logarithms and dividing by \(\eta\) gives both inequalities. \(\square\)

If the loss is only known to lie in \([0,B]\), the deterministic prediction need not satisfy that result. For the randomized aggregate, however, exponential weights gives, for every \(\eta>0\),

$$ \sum_{t=1}^n\sum_j w_{t,j}\ell_{t,j} \leq L_j+\frac{\log(1/\pi_j)}{\eta}+\frac{\eta nB^2}{8}. $$

For completeness, write \(m_t=\sum_jw_{t,j}\ell_{t,j}\). Hoeffding’s lemma for a finite random variable in \([0,B]\) gives \(\log\sum_jw_{t,j}e^{-\eta\ell_{t,j}}\leq-\eta m_t+\eta^2B^2/8\). The sum inside the logarithm is \(Z_{t+1}/Z_t\). Rearranging, summing over rounds, and using \(Z_1=1\) gives \(\sum_tm_t\leq-\log Z_{n+1}/\eta+\eta nB^2/8\). Finally \(Z_{n+1}\geq\pi_j e^{-\eta L_j}\) gives the stated bound. This proof uses bounded losses and randomized expected loss; it does not establish the same claim for an arbitrary deterministic average prediction. \(\square\)

If \(n\), \(B\), and the comparator’s prior mass are known, minimizing the last two terms gives \(\eta=\sqrt{8\log(1/\pi_j)/(nB^2)}\) and penalty \(B\sqrt{n\log(1/\pi_j)/2}\). This choice concerns the bounded-loss regret bound. When exp-concavity provides a deterministic guarantee, a valid exp-concavity temperature is the relevant constraint instead.

Worked Example: Bounded Loss and a Randomized Comparator

Worked Example: Bounded Loss and a Randomized Comparator

Suppose four candidates have losses in \([0,1]\) for 20 rounds. Candidate 1 has prior mass \(0.1\), and take \(\eta=1\). What bound follows for the randomized aggregate’s expected cumulative loss relative to candidate 1?

Here \(B=1\), \(n=20\), and \(\log(1/\pi_1)=\log 10\approx2.302585\). Substitution gives

$$ \sum_{t=1}^{20}\sum_jw_{t,j}\ell_{t,j} \leq L_1+\log 10+\frac{20}{8} =L_1+4.802585\ldots \approx L_1+4.803. $$

The temperature minimizing this bound for candidate 1 is \(\sqrt{8\log(10)/20}\approx0.9597\). The corresponding penalty is \(\sqrt{20\log(10)/2}\approx4.7985\). Both calculations concern the randomized aggregate’s expected loss. Without an additional property such as exp-concavity, neither calculation licenses replacing that randomized choice by the average of the candidates’ predictions.

Squared Loss: Check the Action Range and the Arithmetic

For squared loss \(\ell(y,a)=(y-a)^2\), the deterministic guarantee requires a valid exp-concavity temperature on the action and outcome ranges. For \(y,a\in[0,1]\), differentiating twice with respect to \(a\) gives

$$ \frac{d^2}{da^2}e^{-\eta(y-a)^2} = e^{-\eta(y-a)^2}\left(4\eta^2(y-a)^2-2\eta\right). $$

Because \(|y-a|\leq1\), this is nonpositive whenever \(0<\eta\leq1/2\). Thus the required concavity holds throughout this range. If predictions or outcomes are not confined to the stated ranges, this argument no longer establishes that temperature.

Worked Example: Four Predictors Under Squared Loss

Use four predictors with uniform prior; three always predict 0 and one always predicts 1. Let the outcomes be \(0,0,1\), and take \(\eta=1/2\), which is valid for predictions and outcomes in \([0,1]\). After the first \(t-1\) rounds, the three zero-predictors each have unnormalized weight \(1/4\), while the one-predictor has unnormalized weight \((1/4)e^{-\eta(t-1)}\). The aggregate prediction is therefore

$$ a_t=\frac{e^{-(t-1)/2}}{3+e^{-(t-1)/2}}. $$

On round 1, the aggregate predicts \(1/4\), so its squared loss at outcome 0 is \((1/4)^2=1/16\). On round 2, its prediction is \(a_2=e^{-1/2}/(3+e^{-1/2})\approx0.16818\), and its loss is \(a_2^2\approx0.02828\). On round 3, its prediction is \(a_3=e^{-1}/(3+e^{-1})\approx0.10923\), and its loss at outcome 1 is \((1-a_3)^2\approx0.79347\). Thus the cumulative loss is

$$ \frac{1}{16}+a_2^2+(1-a_3)^2 \approx 0.06250+0.02828+0.79347 =0.88425 \approx0.884. $$

The best fixed candidate here is a zero-predictor, with cumulative loss \(1\). Its prior mass is \(1/4\), so the exp-concave bound is \(1+\log(4)/(1/2)\approx3.773\). The aggregate’s directly calculated loss is below that bound.

Logistic Loss: Bounded Scores Give a Deterministic Rule

For a binary outcome \(y\in\{0,1\}\), let \(s\) be a score and use logistic loss \(\ell(y,s)=\log(1+\exp(-(2y-1)s))\). If \(s\in[-B,B]\), put \(z=(2y-1)s\). Differentiating with respect to \(s\), and writing \(r=1/(1+e^z)\), gives \(|\ell'(y,s)|=r\) and \(\ell''(y,s)=r(1-r)\). Hence \(\ell''/(\ell')^2=(1-r)/r=e^z\geq e^{-B}\). Since \[ \frac{d^2}{ds^2}e^{-\eta\ell(y,s)} =\eta e^{-\eta\ell(y,s)}\left(\eta(\ell'(y,s))^2-\ell''(y,s)\right), \] the transformed loss is concave whenever \(0<\eta\leq e^{-B}\). A weighted average of scores remains in \([-B,B]\), so the deterministic theorem applies to score averaging on this range.

Worked Example: Logistic Score Averaging

Consider two candidates with scores \(+1\) and \(-1\), prior masses \(3/4\) and \(1/4\), and a single outcome \(y=1\). The score range is \([-1,1]\), so take \(\eta=e^{-1}\approx0.367879\). Before the outcome, the aggregate score is \((3/4)(1)+(1/4)(-1)=1/2\). Its loss is \(\log(1+e^{-1/2})\approx0.47408\).

Candidate 1 has loss \(\log(1+e^{-1})\approx0.31326\). Its prior penalty is \(\log(4/3)/e^{-1}=e\log(4/3)\approx0.78241\). The theorem therefore gives the upper bound \(0.31326+0.78241\approx1.09567\) for the aggregate loss. The directly calculated loss \(0.47408\) satisfies it. The bound is loose in this one-round example, but its assumptions and comparator are explicit.

Log Loss: Use the Sequential Probability Mixture

For log loss, candidate \(j\) assigns probability \(p_{t,j}(x_t)\) to the observed outcome \(x_t\). With weights proportional to \(\pi_j\) times the candidates’ likelihoods of past observations, predict using the mixture probability \(q_t(x)=\sum_j w_{t,j}p_{t,j}(x)\). Assume the candidate distributions are normalized and the mixture assigns positive probability to each observed outcome. Multiplying the sequential predictive probabilities gives the identity

$$ \prod_{t=1}^n q_t(x_t) = \sum_j\pi_j\prod_{t=1}^n p_{t,j}(x_t). $$

To verify it, after \(t-1\) observations the weight of candidate \(j\) is proportional to \(\pi_j\prod_{s<t}p_{s,j}(x_s)\). The mixture probability at round \(t\) is the ratio of the weighted likelihood sum through \(t\) to the corresponding sum through \(t-1\). Multiplying these ratios cancels all intermediate sums, leaving the displayed identity; the initial sum is \(\sum_j\pi_j=1\). As the right side is at least \(\pi_j\prod_t p_{t,j}(x_t)\), taking negative logarithms proves

$$ -\sum_{t=1}^n\log q_t(x_t) \leq -\sum_{t=1}^n\log p_{t,j}(x_t)+\log(1/\pi_j). $$

Worked Example: A Two-Outcome Sequence Under Log Loss

There are two candidates with prior masses \(0.6\) and \(0.4\). On the first observation, their probabilities are \(0.8\) and \(0.3\); on the second observation, they assign probabilities \(0.2\) and \(0.7\) to the observed outcome. Candidate 1 assigns probability \(0.8(0.2)=0.16\) to the sequence. The mixture assigns probability \(0.6(0.8)+0.4(0.3)=0.60\) to the first observation. Its updated weights are \(0.48/0.60=0.8\) and \(0.12/0.60=0.2\), so the second predictive probability is \(0.8(0.2)+0.2(0.7)=0.30\). The sequence probability under the mixture is therefore \(0.60(0.30)=0.18\).

The mixture’s cumulative log loss is \(-\log(0.18)\approx1.715\). Candidate 1’s cumulative log loss plus its prior penalty is \[ -\log(0.16)+\log(1/0.6) \approx1.832581+0.510826 =2.343407 \approx2.343. \] Thus the mixture’s loss is below the guaranteed comparator value. The penalty is added to the candidate’s cumulative loss; it is not a change to the candidate’s probabilities.

Common Mistakes and a Final Checklist

Most errors in loss-specific aggregation come from applying a valid formula to a different prediction rule, action range, or comparator. Before calculating, state what is being averaged and what the guarantee compares against.

  • Using boundedness to justify deterministic averaging. Bounded losses give a regret bound for randomized expected loss. To transfer a bound to a deterministic average prediction, establish an appropriate property such as exp-concavity.
  • Using an exp-concavity temperature outside its range. A temperature justified for squared loss on \([0,1]\), or logistic scores on \([-B,B]\), is not automatically valid beyond that range.
  • Changing the comparator without changing the proof. The displayed exponential-weights bounds compare with a fixed candidate \(j\), and include \(\log(1/\pi_j)/\eta\) or \(\log(1/\pi_j)\). A different comparator requires a guarantee that covers it.
  • Rounding intermediate quantities too early. Keep unrounded exponentials and logarithms through the final addition, then round the final result. This matters when reporting a cumulative loss or penalty.
1
Name the prediction rule.
Decide whether the procedure randomizes over candidates, averages predictions, averages scores, or mixes probabilities sequentially.
2
Check the loss assumptions.
For bounded loss, verify the range and use the randomized guarantee. For deterministic averaging, verify exp-concavity on the actual action range. For log loss, form the normalized sequential probability mixture.
3
Specify the comparator, prior and temperature.
Identify the candidate being compared, its prior mass, and a temperature allowed by the relevant guarantee; then calculate the penalty without premature rounding.

Check Your Understanding

For each problem, identify the guarantee that applies before doing any calculation.

  1. Losses are bounded in \([0,2]\), but no curvature property is known. What kind of aggregate does the bounded-loss regret inequality directly control?
  2. For squared loss with outcomes and predictions in \([0,1]\), why is \(\eta=1/2\) admissible for deterministic prediction averaging?
  3. A logistic-score problem uses scores in \([-2,2]\). What upper bound on \(\eta\) follows from the exp-concavity calculation in this tutorial?
  4. In the log-loss example, what is the numerical prior penalty for a candidate with prior mass \(0.1\)?
  5. Why does the prior-mass penalty increase when the comparator candidate receives less prior weight?
Clinical Biostats