Tutorials › Statistical Learning (Graduate) › Hedge Regret for Bounded Expert Losses

Online Regret and Batch Conversion · Tutorial 374 of 989

Hedge Regret for Bounded Expert Losses

Learn how exponential weights produce a regret guarantee against the best fixed expert when losses are bounded and the horizon is known.

Advanced 9 min read

What You'll Learn

  • Define Hedge’s exponential-weights update for full-information losses in [0,1].
  • Derive the regret guarantee by tracking the sum of exponentiated cumulative losses.
  • Prove the bounded-loss exponential-moment inequality used in the potential argument.
  • Choose the learning rate that minimizes the finite-horizon bound.
  • Distinguish mixture-loss guarantees from guarantees for a sampled expert’s realized loss.
  • Recognize common errors in the update timing and interpretation of regret.

Why Exponential Weights?

Suppose a learner observes the losses of \(K\) experts over \(T\) rounds and wants to perform nearly as well as the best single expert in hindsight. The learner must choose weights before seeing the current round’s losses; afterward, the full loss vector is revealed. Hedge turns this protocol into a simple update: experts that have accumulated larger losses receive exponentially less weight.

The update is useful because it adapts to the observed losses without knowing in advance which expert will do best. A potential function—the sum of exponentials of cumulative losses—will let us compare the learner’s cumulative loss with every expert’s cumulative loss at once.

Protocol and Hedge Update

There are \(K\) experts, where \(K\) is finite and at least 2. On round \(t\), the learner chooses a probability vector \(p_t=(p_{t,1},\ldots,p_{t,K})\) using the losses from rounds \(1,\ldots,t-1\). The environment then reveals losses \(\ell_{t,i}\in[0,1]\) for all experts \(i\). The learner’s round-\(t\) mixture loss is \(\sum_{i=1}^K p_{t,i}\ell_{t,i}\). Define expert \(i\)’s cumulative loss through round \(T\) by \(L_{T,i}=\sum_{t=1}^T\ell_{t,i}\), and define the learner’s cumulative mixture loss by \(\widehat L_T=\sum_{t=1}^T\sum_{i=1}^K p_{t,i}\ell_{t,i}\).

Definition: For a fixed expert \(i\), the external regret through round \(T\) is \(\widehat L_T-L_{T,i}\). The regret against the best fixed expert is \(\widehat L_T-\min_{1\leq i\leq K}L_{T,i}\). The word “fixed” means the same comparator expert is used for all rounds.

Hedge starts with equal, unnormalized weights \(w_{1,i}=1\). Given a learning rate \(\eta>0\), after observing the losses on round \(t\), it updates the weights according to

$$ w_{t+1,i}=w_{t,i}\exp(-\eta\ell_{t,i}),\qquad p_{t,i}=\frac{w_{t,i}}{\sum_{j=1}^K w_{t,j}}. $$

Equivalently, since \(w_{t,i}=\exp(-\eta L_{t-1,i})\), the round-\(t\) probability is proportional to the exponential of minus \(\eta\) times the expert’s past cumulative loss. The learner uses past losses to choose \(p_t\), then updates only after the current loss vector is revealed. This is the full-information setting: every expert’s current loss is observed, including the losses of experts the learner did not choose.

Worked Example: Updating Three Expert Weights

Suppose there are three experts, the current probabilities are equal, and the learning rate is \(\eta=\log 2\). The newly revealed losses are \((0,1/2,1)\). Compute the next probabilities.

The multiplicative factors for the three experts are, respectively, \(\exp(0)=1\), \(\exp(-(\log 2)/2)=1/\sqrt{2}\), and \(\exp(-\log 2)=1/2\). Since the current weights are equal, the unnormalized new weights are proportional to \((1,1/\sqrt{2},1/2)\). Their sum is \(1+1/\sqrt{2}+1/2\), approximately \(2.2071\).

Thus the next probabilities are \(1/(1+1/\sqrt{2}+1/2)\), \((1/\sqrt{2})/(1+1/\sqrt{2}+1/2)\), and \((1/2)/(1+1/\sqrt{2}+1/2)\). Numerically, these are approximately \((0.4531,0.3204,0.2265)\), which sum to 1 up to rounding. The expert with zero loss gains probability, while the expert with loss 1 loses the most.

The Potential Argument

For the proof, let \(L_{0,i}=0\) and define the potential after round \(t\) as the sum of exponentiated negative cumulative losses:

$$ W_t=\sum_{i=1}^K\exp(-\eta L_{t,i}),\qquad W_0=K. $$

The crucial step is to bound how much the potential can decrease on one round. We first prove the bounded-variable exponential-moment inequality used in that step.

Lemma: If a random variable \(X\) takes values in \([0,1]\), then for every real \(\lambda\), \(\log E[\exp(\lambda(X-E[X]))]\leq\lambda^2/8\).

Proof. Write \(\mu=E[X]\). Convexity of \(x\mapsto\exp(\lambda x)\) implies, for every \(x\in[0,1]\), that \(\exp(\lambda x)\leq (1-x)+x\exp(\lambda)\). Taking expectations and centering gives

$$ E[\exp(\lambda(X-\mu))] \leq \exp(-\lambda\mu)\{1-\mu+\mu\exp(\lambda)\}. $$

For \(0<\mu<1\), let \(g(\lambda)=\log(1-\mu+\mu\exp(\lambda))-\mu\lambda\). Direct differentiation gives \(g(0)=g'(0)=0\) and \(g''(\lambda)=q(\lambda)(1-q(\lambda))\), where \(q(\lambda)=\mu\exp(\lambda)/(1-\mu+\mu\exp(\lambda))\). Since \(0\leq q(\lambda)\leq1\), \(g''(\lambda)\leq1/4\). The integral form of Taylor’s theorem, valid for either sign of \(\lambda\), therefore yields \(g(\lambda)\leq\lambda^2/8\). If \(\mu=0\) or \(\mu=1\), then \(X=\mu\) with probability 1 and the desired inequality holds directly. Taking logarithms proves the lemma. \(\square\)

Theorem: For any finite sequence of loss vectors with \(\ell_{t,i}\in[0,1]\), any \(\eta>0\), and Hedge initialized with equal weights, \(\widehat L_T-\min_i L_{T,i}\leq \log(K)/\eta+\eta T/8\). The inequality holds for every realized sequence of bounded loss vectors; no stochastic assumption on the losses is required.

Proof. The ratio of successive potentials is

$$ \frac{W_t}{W_{t-1}} =\sum_{i=1}^K p_{t,i}\exp(-\eta\ell_{t,i}). $$

Consider a random variable that takes value \(\ell_{t,i}\) with probability \(p_{t,i}\). Its mean is the learner’s mixture loss on round \(t\). Apply the lemma with \(\lambda=-\eta\), and then take logarithms of the potential ratio. This gives

$$ \log\frac{W_t}{W_{t-1}} \leq-\eta\sum_{i=1}^Kp_{t,i}\ell_{t,i}+\frac{\eta^2}{8}. $$

Summing over \(t=1,\ldots,T\) telescopes the left side. Since \(W_0=K\), we obtain

$$ \log W_T-\log K \leq-\eta\widehat L_T+\frac{\eta^2T}{8}. $$

For any expert \(i\), the potential includes its term \(\exp(-\eta L_{T,i})\). In particular, it includes a term for an expert with minimum cumulative loss, so \(W_T\geq\exp(-\eta\min_i L_{T,i})\). Thus \(\log W_T\geq-\eta\min_i L_{T,i}\). Combining this lower bound with the upper bound just derived and rearranging gives

$$ \eta\left(\widehat L_T-\min_i L_{T,i}\right) \leq\log K+\frac{\eta^2T}{8}. $$

Dividing by \(\eta>0\) proves the theorem. \(\square\)

Worked Example: Two Experts Over Two Rounds

Take two experts, let \(\eta=\log 2\), and suppose their loss vectors are \((0,1)\) on round 1 and \((1,0)\) on round 2. Calculate Hedge’s mixture regret and compare it with the theorem’s bound.

On round 1, the probabilities are \((1/2,1/2)\), so the mixture loss is \((1/2)0+(1/2)1=1/2\). The weights after that round are proportional to \((1,1/2)\), giving round-2 probabilities \((2/3,1/3)\). The round-2 mixture loss is \((2/3)1+(1/3)0=2/3\). Hence \(\widehat L_2=1/2+2/3=7/6\).

Each expert has cumulative loss 1: expert 1 incurs \(0+1\), and expert 2 incurs \(1+0\). The best expert’s loss is therefore 1, and Hedge’s regret is \(7/6-1=1/6\). The theorem gives the upper bound \(\log 2/(\log 2)+(\log 2)2/8=1+(\log 2)/4\), approximately \(1.1733\). This bound is valid but not tight for this particular sequence.

Choosing the Learning Rate When the Horizon Is Known

The theorem gives a bound for every positive learning rate. If \(T\) is known before learning begins, choose \(\eta\) to minimize \(\log(K)/\eta+\eta T/8\). For \(K\geq2\) and \(T\geq1\), differentiating with respect to \(\eta\) gives \(-\log(K)/\eta^2+T/8=0\), so the minimizing rate and the resulting guarantee are

$$ \eta^*=\sqrt{\frac{8\log K}{T}}, \qquad \widehat L_T-\min_iL_{T,i} \leq\sqrt{\frac{T\log K}{2}}. $$

At this choice, the two terms in the original bound are equal: each is \(\sqrt{T\log K/8}\). The guarantee grows with the square root of the horizon and the logarithm of the number of experts, rather than linearly with \(T\). The learning rate controls the tradeoff: a small \(\eta\) makes the penalty \(\log(K)/\eta\) large, while a large \(\eta\) makes the term \(\eta T/8\) large.

Worked Example: Optimizing the Rate for Four Experts

Suppose \(K=4\) and the known horizon is \(T=10\). The optimal rate is \(\eta^*=\sqrt{8\log(4)/10}\), approximately \(1.0531\). Using the rounded rate \(\eta=1.053\), the first term in the regret bound is \(\log(4)/1.053\approx1.3165\), and the second is \(1.053(10)/8=1.31625\). Their sum is approximately \(2.6328\), or \(2.633\) to three decimal places.

Using the unrounded optimal rate gives the same result directly: \(\sqrt{10\log(4)/2}=\sqrt{5\log(4)}\approx2.6328\). The rounded and unrounded calculations agree to the displayed precision.

What the Guarantee Does—and Does Not—Say

The theorem is deterministic once the loss vectors are specified: it applies to every bounded sequence, even if the environment chooses each loss vector after observing the learner’s current probabilities. It compares cumulative mixture loss with the single best expert over the whole sequence. It does not claim that Hedge will identify the best expert before the sequence ends, nor does it compare against a different expert chosen separately on every round.

If the learner implements \(p_t\) by randomly sampling one expert, then \(\sum_i p_{t,i}\ell_{t,i}\) is the conditional expected loss on that round. The bound proved here is for the sum of these mixture losses, equivalently the cumulative conditional expected loss. It is not a pathwise bound on the cumulative losses of the sampled experts: sampling adds randomness, and a guarantee for realized sampled loss would require additional analysis.

A common mistake is to update the probabilities using the current loss vector and then describe the resulting decision as though it had been made before that vector was revealed. That reverses the protocol: \(p_t\) must depend only on losses through round \(t-1\). Another mistake is to treat the theorem as a bound on regret to a changing comparator. The potential argument lower-bounds the final potential using one expert’s total loss, so the comparator is fixed across rounds.

Key takeaway: With full information and losses in \([0,1]\), Hedge assigns weight proportional to \(\exp(-\eta L_{t-1,i})\). A potential argument bounds its regret to the best fixed expert by \(\log(K)/\eta+\eta T/8\); when \(T\) is known, \(\eta=\sqrt{8\log(K)/T}\) gives regret at most \(\sqrt{T\log(K)/2}\).

Check Your Understanding

Use the update and proof in this tutorial to answer the following questions.

  1. Why must the round-\(t\) probabilities depend on losses through round \(t-1\), rather than the round-\(t\) losses?
  2. For a fixed learning rate, which term in the regret bound becomes larger when \(\eta\) is made smaller, and which becomes smaller?
  3. Where in the potential argument is the assumption that each expert’s loss lies in \([0,1]\) used?
  4. What comparator does the theorem use, and how does it differ from a comparator that may change experts each round?
  5. If the learner samples an expert according to \(p_t\), what loss quantity is bounded directly by the theorem?
Clinical Biostats