Let X1,X2,...,XT be a sequence of T binary values.
We predict at each t∈[T], the value of Xt.
Our predictions are based on the ones from a set of n experts.
At each time t∈[T], each expert i∈[n] generates a prediction pit of Xt.
Based on the experts' predictions, we make our own pAt.
The goal to minimize the number of wrong predictions/mistakes.
Measurement of Error
The first question is how good can we do?
Define
Lit: the indicator for the expert i making a mistake at round t.
Li=∑t∈[T]Lit: the total number of mistakes expert i makes.
LA: the mistakes by our algorithm (denoted as A).
Ideally, we would like achieve as few mistakes as
t∈[T]∑i∈[n]minLit.
However, this is impossible.
To see this, let {Xt,t∈[T]} be independent Bernoulli random variables with equal probability taking
1 and 0.
Whatever our strategy is, the expected number of mistakes is T/2.
On the other hand, it is possible that ∑t∈[T]mini∈[n]Lit=0.
Despite this negative result, there is hope to achieve as few mistakes as the best expert (up to some constant), that is
LA∈Oi∈[n]mint∈[T]∑Lit=O(i∈[n]minLi).
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≤i∈[n]minLi+logn.
Algorithm 1. Follow the Majority
Let E0←[n] be the set of all experts.
Fort←1 to T
Let S be the subset of Et−1 that predicts 0 at time t.
Let Sˉ be the subset of Et−1 that predicts 1 at time t.
If∣S∣>∣Sˉ∣, then predict 0 (pAt←0);
else predict 1 (pAt←1).
Reveal Xt.
IfXt=0, thenEt←S;
elseEt←Sˉ.
The key observation is that the set we maintain halves each time we make a mistake.
Halving the set can happen at most logn times, as there are only n experts.
Further, we need the assumption of a perfect expect, as otherwise Et can be empty.
Proof. Let M be the number of mistakes the algorithm makes. Each time it makes a mistake, the size of Et shrink by half. Hence,
1≤∣ET∣≤∣E1∣2M1=2Mn.
The first inequality follows from the existence of perfect expert. It concludes that
M≤logn.
□
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], 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≤(i∈[n]minLi+1)⋅logn.
Proof. As analysed before, between two consecutive resets of Et, the algorithm makes at most logn mistakes while the best expert makes at least one mistake. Therefore,
The previous algorithm forgets the historical performance of the experts each time it resets Et, which might contain helpful information.
To fix this, we assign each expert i a weight wit, follow the weighted majority at time t.
Theorem. The algorithm Follow the Weighted Majority achieves
LA≤2.41⋅(i∈[n]minLi+logn).
Algorithm 3. Follow the Weighted Majority
Set wi1←1,∀i∈[n].
For t←1 to T
Let S be the set of experts who predict 0.
Let Sˉ be the set of experts who predict 1.
If ∑i∈Swit>∑i∈Sˉwit, then predict 0 (pAt←0);
else predict 1 (pAt←1).
Reveal Xt.
For each expert i∈[n]
If it predicts wrong then wit+1←wit/2
else wit+1←wit
Intuition on Why the Algorithm Works.
Assume that expert i is the one that minimizes the loss Li.
At round T, its weight wiT is given by (1/2)Li.
The total weight at round T, denoted by WT, can be lower bounded using wiT.Specifically, if Wt becomes too small for some t∈[T], then wit will constitute the majority of the weights.
As a result, the algorithm should not incur significantly more errors than expert i.
This ensures that the algorithm’s performance is competitive with the best expert while adapting over time.
Proof. Let Wt=∑i∈[n]wit.
Each round t the algorithms make a mistake, the sum of weights of experts who predict wrong is at least 0.5⋅Wt.
Such weights halve at this round.
Hence
Wt+1≤Wt(1−21⋅21)=43Wt.
Fix an i∈[n]. Recall Li is the number of mistakes experts i makes throughout the T rounds.
It follows that,
wiT=(21)Li≤WT≤(43)LAW0=(43)LA⋅n,
which implies
LA≤log341(Li+logn)≤2.41⋅(Li+logn).
□
Remark. It is not necessary to halve an expert's weight when it makes a mistake.
We can decrease it by any factor (1−ϵ) for ϵ∈(0,1). In such case, we get
We have used the fact that ln(1−ϵ)≥−ϵ−ϵ2 for ϵ∈[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 t,
The expert i performs action, termed ait.
The environment returns the loss of performing ait, denoted as ℓit∈[0,1].
Note that there is no restriction of the experts' actions and their losses (as long as they are within [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≤i∈[n]minLi+2Tlnn,
where Li≐∑t∈[T]ℓit is the loss of expert i.
This implies that the average expected loss converges at a rate of 1/T to the best one.
Algorithm 4. Multiplicative Weight Update
Set wi1←1,∀i∈[n].
For t←1 to T
Let Wt=∑i∈[n]wit.
Follow action ait with probability wit/Wt.
For each expert i∈[n]:
wit+1←wit⋅(1−ϵ⋅ℓit)
At a high level, at each round,
the algorithm follows expert i with probability proportional to wit.
the weight wit is decreased proportionally to ℓit.
Proof.
Let ℓAt be the loss of the algorithm at round t, and LA≐∑t∈[T]ℓAt.
Claim 1.lnWT+1 is inversely proportional to E[LA].