Problem

Let X1,X2,...,XTX_1, X_2, ..., X_T be a sequence of TT binary values. We predict at each t∈[T]t \in [T], the value of XtX_t. Our predictions are based on the ones from a set of nn experts. At each time t∈[T]t \in [T], each expert i∈[n]i \in [n] generates a prediction pitp_i^t of XtX_t. Based on the experts' predictions, we make our own pAtp_A^t. The goal to minimize the number of wrong predictions/mistakes.

Measurement of Error

The first question is how good can we do?

Define

  1. Lit:L_i^t: the indicator for the expert ii making a mistake at round tt.
  2. Li=∑t∈[T]Lit:L_i = \sum_{t \in [T] } L_i^t: the total number of mistakes expert ii makes.
  3. LA:L_A: the mistakes by our algorithm (denoted as AA).

Ideally, we would like achieve as few mistakes as

∑t∈[T]min⁡i∈[n]Lit. \sum_{t \in [T] } \min_{i \in [n]} L_i^t.

However, this is impossible. To see this, let {Xt,t∈[T]}\{ X_t , t \in [T] \} be independent Bernoulli random variables with equal probability taking 11 and 00. Whatever our strategy is, the expected number of mistakes is T/2T / 2. On the other hand, it is possible that ∑t∈[T]min⁡i∈[n]Lit=0\sum_{t \in [T] } \min_{i \in [n]} L_i^t = 0.

Despite this negative result, there is hope to achieve as few mistakes as the best expert (up to some constant), that is

LA∈O(min⁡i∈[n]∑t∈[T]Lit)=O(min⁡i∈[n]Li). L_A \in O \left( \min_{i \in [n]} \sum_{t \in [T] } L_i^t \right) = O \left( \min_{i \in [n] } L_i \right).

Algorithms

Follow the Majority

We start with an easy case where an expert who always predicts correctly. In such case, we can maintain a set of experts who do not make any mistake so far. Each time we make a decision, we follow the majority of the set.

Theorem. If there is a perfect expert, the algorithm Follow the Majority achieves

LA≤min⁡i∈[n]Li+log⁡n. L_A \le \min_{i \in [n] } L_i + \log n.

Algorithm 1. Follow the Majority

  1. Let E0←[n]E_0 \leftarrow [n] be the set of all experts.
  2. For t←1t \leftarrow 1 to TT
  3. \qquad Let SS be the subset of Et−1E_{t - 1} that predicts 0 at time tt.
  4. \qquad Let Sˉ\bar S be the subset of Et−1E_{t - 1} that predicts 1 at time tt.
  5. \qquad If ∣S∣>∣Sˉ∣|S| > |\bar S|, then predict 00 (pAt←0p_A^t \leftarrow 0);
  6.  \qquad\qquad\qquad\quad\, else predict 11 (pAt←1p_A^t \leftarrow 1).
  7. \qquad Reveal XtX_t.
  8. \qquad If Xt=0X_t = 0, then Et←SE_t \leftarrow S;
  9.  \qquad\qquad\qquad\, else  Et←Sˉ\,E_t \leftarrow \bar S.

The key observation is that the set we maintain halves each time we make a mistake. Halving the set can happen at most log⁡n\log n times, as there are only nn experts. Further, we need the assumption of a perfect expect, as otherwise EtE_t can be empty.

Proof. Let MM be the number of mistakes the algorithm makes. Each time it makes a mistake, the size of EtE_{t} shrink by half. Hence,

1≤∣ET∣≤∣E1∣12M=n2M. 1 \le |E_T| \le |E_1| \frac{1}{2^M} = \frac{n}{2^M}.

The first inequality follows from the existence of perfect expert. It concludes that

M≤log⁡n. M \le \log n.

□\square

Follow the Majority With Reset

Without the assumption of perfect expert, one simple modification we can make to Follow the Majority is resetting Et=[n]E_t = [n], if it is assigned an empty set. We call such an algorithm Follow the Majority With Reset.

Theorem. If there isn't a perfect expert, the algorithm Follow the Majority With Reset achieves

LA≤(min⁡i∈[n]Li+1)⋅log⁡n. L_A \le \left( \min_{i \in [n] } L_i + 1 \right) \cdot \log n.

Proof. As analysed before, between two consecutive resets of EtE_t, the algorithm makes at most log⁡n\log n mistakes while the best expert makes at least one mistake. Therefore,

LAlog⁡n≤min⁡i∈[n]Li+1  ⟹  LA≤(min⁡i∈[n]Li+1)⋅log⁡n. \frac{L_A}{ \log n } \le \min_{i \in [n] } L_i + 1 \implies L_A \le \left( \min_{i \in [n]} L_i + 1\right) \cdot \log n.

□\square

Follow the Weighted Majority

The previous algorithm forgets the historical performance of the experts each time it resets EtE_t, which might contain helpful information. To fix this, we assign each expert ii a weight witw_i^t, follow the weighted majority at time tt.

Theorem. The algorithm Follow the Weighted Majority achieves

LA≤2.41⋅(min⁡i∈[n]Li+log⁡n). L_A \le 2.41 \cdot \left( \min_{i \in [n]} L_i + \log n \right).

Algorithm 3. Follow the Weighted Majority

  1. Set wi1←1,∀i∈[n].w_i^1 \leftarrow 1, \forall i \in [n].
  2. For t←1t \leftarrow 1 to TT
  3. \qquad Let SS be the set of experts who predict 00.
  4. \qquad Let Sˉ\bar S be the set of experts who predict 11.
  5. \qquad If ∑i∈Swit>∑i∈Sˉwit\sum_{i \in S} w_i^t > \sum_{i \in \bar S} w_i^t, then predict 00 (pAt←0p_A^t \leftarrow 0);
  6. \qquad\qquad\qquad\qquad\qquad\qquad else predict 11 (pAt←1p_A^t \leftarrow 1).
  7. \qquad Reveal XtX_t.
  8. \qquad For each expert i∈[n]i \in [n]
  9. \qquad\qquad If it predicts wrong then wit+1←wit/2w_i^{t + 1} \leftarrow w_i^t / 2
  10. \qquad\qquad \qquad\qquad\qquad\quad else wit+1←witw_i^{t + 1} \leftarrow w_i^t

Intuition on Why the Algorithm Works. Assume that expert ii is the one that minimizes the loss LiL_i. At round TT, its weight wiTw_i^T is given by (1/2)Li(1/2)^{L_i}. The total weight at round TT, denoted by WTW^T, can be lower bounded using wiTw_i^T.Specifically, if WtW^t becomes too small for some t∈[T]t \in [T], then witw_i^t will constitute the majority of the weights. As a result, the algorithm should not incur significantly more errors than expert ii. This ensures that the algorithm’s performance is competitive with the best expert while adapting over time.

Proof. Let Wt=∑i∈[n]witW^t = \sum_{i \in [n] } w_i^t. Each round tt the algorithms make a mistake, the sum of weights of experts who predict wrong is at least 0.5⋅Wt0.5 \cdot W^t. Such weights halve at this round. Hence

Wt+1≤Wt(1−12⋅12)=34Wt. W^{t + 1} \le W^t \left( 1 - \frac{1}{2} \cdot \frac{1}{2} \right) = \frac{3}{4} W^t.

Fix an i∈[n]i \in [n]. Recall LiL_i is the number of mistakes experts ii makes throughout the TT rounds. It follows that,

wiT=(12)Li≤WT≤(34)LAW0=(34)LA⋅n, w_i^T = \left( \frac{1}{2} \right)^{L_i} \le W^T \le \left( \frac{3}{4} \right)^{L_A} W^0 = \left( \frac{3}{4} \right)^{L_A} \cdot n,

which implies

LA≤1log⁡43(Li+log⁡n)≤2.41⋅(Li+log⁡n). L_A \le \frac{1}{ \log \frac{4}{3} } ( L_i + \log n) \le 2.41 \cdot (L_i + \log n).

□\square

Remark. It is not necessary to halve an expert's weight when it makes a mistake. We can decrease it by any factor (1−ϵ)(1 - \epsilon) for ϵ∈(0,1)\epsilon \in (0, 1). In such case, we get

(1−ϵ)Li≤(1−1−(1−ϵ)2)LAn  ⟹  Li⋅ln⁡(1−ϵ)≤LA⋅ln⁡(1−ϵ2)+ln⁡n  ⟹  Li⋅ln⁡(1−ϵ)≤LA⋅(−ϵ2)+ln⁡n  ⟹  Li⋅(−ϵ−ϵ2)≤LA⋅(−ϵ2)+ln⁡n  ⟹  LA≤2(1+ϵ)⋅Li+2ϵ⋅ln⁡n. \begin{aligned} &\qquad (1- \epsilon)^{L_i} \le \left( 1 - \frac{1 - (1 - \epsilon)}{2} \right)^{L_A} n \\ &\implies L_i \cdot \ln (1 -\epsilon) \le L_A \cdot \ln \left( 1 - \frac{\epsilon}{ 2 } \right) + \ln n \\ &\implies L_i \cdot \ln (1 -\epsilon) \le L_A \cdot \left( - \frac{\epsilon}{ 2 } \right) + \ln n \\ &\implies L_i \cdot \left( -\epsilon - \epsilon^2 \right) \le L_A \cdot \left( - \frac{\epsilon}{ 2 } \right) + \ln n \\ &\implies L_A \le 2 \left( 1 + \epsilon \right) \cdot L_i + \frac{2}{\epsilon} \cdot \ln n. % &\implies L_A \le \frac{ L_i \ln 1 / (1 - \epsilon) + \ln n}{ \ln 2 / ( 2 - \epsilon ) }. \end{aligned}

We have used the fact that ln⁡(1−ϵ)≥−ϵ−ϵ2\ln(1 - \epsilon ) \ge - \epsilon - \epsilon^2 for ϵ∈[0,2/3]\epsilon \in [0, 2 / 3].

Multiplicative Weight Updates

We are in good shape so far. Let's extend the problem to more general settings. In this cases, the experts interact with the environment in round-robin fashion. At each round tt,

  1. The expert ii performs action, termed aita_i^t.
  2. The environment returns the loss of performing aita_i^t, denoted as ℓit∈[0,1]\ell_i^t \in [0, 1].

Note that there is no restriction of the experts' actions and their losses (as long as they are within [0,1][0, 1]). We will present an algorithm, called Multiplicative Weight Update, which is almost as good as the best expert.

Theorem. The algorithm Multiplicative Weight Update achieves

LA≤min⁡i∈[n]Li+2Tln⁡n, L_A \le \min_{i \in [n] } L_i + 2 \sqrt{ T \ln n },

where Li≐∑t∈[T]ℓitL_i \doteq \sum_{t \in [T] } \ell_i^t is the loss of expert ii.

This implies that the average expected loss converges at a rate of 1/T\sqrt{1 / T} to the best one.

Algorithm 4. Multiplicative Weight Update

  1. Set wi1←1,∀i∈[n]w_i^1 \leftarrow 1, \forall i \in [n].
  2. For t←1t \leftarrow 1 to TT
  3. \qquad Let Wt=∑i∈[n]witW^t = \sum_{i \in [n] } w_i^t.
  4. \qquad Follow action aita_i^t with probability wit/Wtw_i^t / W^t.
  5. \qquad For each expert i∈[n]i \in [n]:
  6. \qquad\qquad wit+1←wit⋅(1−ϵ⋅ℓit)w_i^{t + 1} \leftarrow w_i^t \cdot (1 - \epsilon \cdot \ell_i^t)

At a high level, at each round,

  1. the algorithm follows expert ii with probability proportional to witw_i^t.
  2. the weight witw_i^t is decreased proportionally to ℓit\ell_i^t.

Proof. Let ℓAt\ell_A^t be the loss of the algorithm at round tt, and LA≐∑t∈[T]ℓAtL_A \doteq \sum_{t \in [T] } \ell_A^t.

Claim 1.  ln⁡WT+1\,\ln W^{T + 1} is inversely proportional to E[LA]\mathbb{E} \big[ L_A \big].

Observe

E[ℓAt]=∑i∈[n]witWt⋅ℓit. \mathbb{E} \big[ \ell_A^t \big] = \sum_{i \in [n] } \frac{ w_i^t }{ W^t } \cdot \ell_i^t.

By the update rule of the wiw_i's, we see

Wt+1=∑i∈[n]wit(1−ϵℓit)=Wt⋅(1−ϵ⋅E[ℓAt])≤Wt⋅exp⁡(−ϵ⋅E[ℓAt]). W^{t + 1} = \sum_{i \in [n] } w_i^t (1 - \epsilon \ell_i^t) = W^t \cdot \left( 1 - \epsilon \cdot \mathbb{E} \big[ \ell_A^t \big] \right) \le W^t \cdot \exp \left( - \epsilon \cdot \mathbb{E} \big[ \ell_A^t \big] \right).

By induction and noting that W1=nW^1 = n, we have

WT+1≤W1⋅exp⁡(−∑t∈[T]ϵ⋅E[ℓAt])=n⋅exp⁡(−ϵ⋅E[LA]). W^{T + 1} \le W^1 \cdot \exp \Big( - \sum_{t \in [T] } \epsilon \cdot \mathbb{E} \big[ \ell_A^t \big] \Big) = n \cdot \exp \Big( - \epsilon \cdot \mathbb{E} \big[ L_A \big] \Big).

Claim 2.  ln⁡WT+1\,\ln W^{T + 1} is lower bounded by ∑t∈[T]ln⁡(1−ϵ⋅ℓit)\sum_{t \in [T] } \ln (1 - \epsilon \cdot \ell_i^t).

For each expert i∈[n]i \in [n], its final weight is given by

wiT+1=∏t∈[T](1−ϵ⋅ℓit) w_i^{T + 1} = \prod_{t \in [T] } (1 - \epsilon \cdot \ell_i^t) % \ge 1 - \sum_{t \in [T] } \epsilon \cdot \ell_i^t,

Noting that wiT+1≤WT+1w_i^{T + 1} \le W^{T + 1} proves the claim.

Putting the Claims Together. For each i∈[n]i \in [n], we have

∑t∈[T]ln⁡(1−ϵ⋅ℓit)≤−ϵ⋅E[LA]+ln⁡n. \begin{aligned} % \ln \left( 1 - \epsilon \cdot L_i \right) % \le \sum_{t \in [T] } \ln (1 - \epsilon \cdot \ell_i^t) \le - \epsilon \cdot \mathbb{E} \big[ L_A \big] + \ln n. \end{aligned}

Therefore,

ϵ⋅E[LA]≤−∑t∈[T]ln⁡(1−ϵ⋅ℓit)+ln⁡n. \epsilon \cdot \mathbb{E} \big[ L_A \big] \le - \sum_{t \in [T] } \ln (1 - \epsilon \cdot \ell_i^t) + \ln n.

Via the fact that ln⁡(1−ϵ)≥−ϵ−ϵ2\ln(1 - \epsilon ) \ge - \epsilon - \epsilon^2 for ϵ∈[0,2/3]\epsilon \in [0, 2 / 3], we know that ∀i∈[n]\forall i \in [n],

ϵ⋅E[LA]≤ϵ⋅∑t∈[T]ℓit+ϵ2⋅∑t∈[T](ℓit)2+ln⁡n=ϵ⋅Li+ϵ2⋅∑t∈[T](ℓit)2+ln⁡n. \begin{aligned} \epsilon \cdot \mathbb{E} \big[ L_A \big] &\le \epsilon \cdot \sum_{t \in [T] } \ell_i^t + \epsilon^2 \cdot \sum_{t \in [T] } \big( \ell_i^t \big)^2 + \ln n \\ &= \epsilon \cdot L_i + \epsilon^2 \cdot \sum_{t \in [T] } \big( \ell_i^t \big)^2 + \ln n. \end{aligned}

Dividing both sides by ϵ\epsilon,

E[LA]≤Li+ϵ⋅∑t∈[T](ℓit)2+1ϵ⋅ln⁡n. \begin{aligned} \mathbb{E} \big[ L_A \big] &\le L_i + \epsilon \cdot \sum_{t \in [T] } \big( \ell_i^t \big)^2 + \frac{1}{\epsilon} \cdot \ln n. \end{aligned}

There are various ways to upper bound ∑i∈[T](ℓit)2\sum_{i \in [T] } (\ell_i^t)^2. Naively, we observe that (ℓit)2≤ℓit(\ell_i^t)^2 \le \ell_i^t, since ℓit∈[0,1]\ell_i^t \in [0, 1]. Therefore,

E[LA]≤Li+ϵ⋅Li+1ϵ⋅ln⁡n \mathbb{E} \big[ L_A \big] \le L_i + \epsilon \cdot L_i + \frac{1}{\epsilon} \cdot \ln n

Setting ϵ=(ln⁡n)/T\epsilon = \sqrt{ (\ln n) / T }, we get

E[LA]≤Li+Li⋅ln⁡nT+T⋅ln⁡n≤Li+2T⋅ln⁡n. \begin{aligned} \mathbb{E} \big[ L_A \big] &\le L_i + \sqrt{\frac{L_i \cdot \ln n}{T}} + \sqrt{ T \cdot \ln n} \\ &\le L_i + 2 \sqrt{ T \cdot \ln n}. \end{aligned}

Remark: if we know the value of min⁡i∈[n]Li\min_{i \in [n]} L_i, or we can guess Θ(min⁡i∈[n]Li)\Theta \left( \min_{i \in [n]} L_i \right), then we can achieve

E[LA]≤min⁡i∈[n]Li+Θ(min⁡i∈[n]Li⋅ln⁡n). \mathbb{E} \big[ L_A \big] \le \min_{i \in [n]} L_i + \Theta \left( \sqrt{ \min_{i \in [n]} L_i \cdot \ln n } \right).

■\blacksquare

Reference

[1]. Arora, Sanjeev, Elad Hazan, and Satyen Kale. "The multiplicative weights update method: a meta-algorithm and applications." Theory of computing 8, no. 1 (2012): 121-164.

[2] Aaron Roth, “The Polynomial Weights Algorithm”, NETS 412: Algorithmic Game Theory