Randomized weighted majority algorithm
The randomized weighted majority algorithm (RWMA) is an algorithm in machine learning theory.[1] It is useful in scenarios where a learner faces a sequence of trials and predicts at every step, and where we have reason to believe that some pool of known algorithms will perform well, but we do not know which. It is a simple and effective method based on weighted voting, that improves on the mistake bound of the weighted majority algorithm.
Example
Imagine that every morning before the stock market opens, we get a prediction from a series of "experts" about whether the stock market will go up or down in the next day. Our goal is to aggregate the resulting set of predictions into a single prediction that can then be used to make a buy or sell decision for the day. The RWMA is a method for this aggregation such that, over time, the resulting record of predictions will be nearly as good as that of whichever expert, in hindsight, gave the most accurate predictions.
Motivation
In machine learning, the weighted majority algorithm (WMA) is a deterministic meta-learning algorithm for aggregating expert predictions. In pseudocode, the WMA is as follows:
initialize all experts to weight 1. for each round: poll all the experts and predict based on a weighted majority vote of their predictions. cut in half the weights of all experts that make a mistake.
Suppose there are experts and the best expert makes mistakes. The weighted majority algorithm (WMA) makes at most mistakes. This bound is highly problematic for cases with highly error-prone experts. Suppose, for example, the best expert makes a mistake 20% of the time; that is, in rounds using experts, the best expert makes mistakes. Then, the deterministic weighted majority algorithm only guarantees an upper bound of .
This is not a very good bound, and can be improved by introducing randomization.
Randomized weighted majority algorithm (RWMA)
The randomized weighted majority algorithm is an attempt to improve the dependence of the mistake bound of the WMA on . Instead of predicting based on majority vote, the weights are used as probabilities (hence the name randomized weighted majority).
Precisely, if is the weight of expert , let . Then, we follow expert with probability .
As before, the goal is to bound the worst-case expected number of mistakes, assuming that the adversary (the world) must select an answer as correct before we randomly choose which expert to follow. This is better because the worst case for the deterministic weighted majority algorithm is when the weights are nearly split 50/50, but the randomized weighted majority algorithm still has a 50/50 chance of getting it right in such cases.
Note: to trade off between dependence in the mistake bound on and , we will consider any possible constant for multiplying the weight of an expert after a missed guess (instead of necessarily using as in the original description of the WMA).
Analysis
Let denote the total weight and denote the fraction of weight on the wrong answers at round . By definition, is the probability that the algorithm makes a mistake on round . It follows, then, from the linearity of expectation, that if denotes the total number of mistakes made during the entire process, .
Now, notice that after round , the total weight is decreased by , since all weights corresponding to a wrong answer are multiplied by . It then follows that . By telescoping, since , it follows that the total weight after the process concludes is
On the other hand, suppose that is the number of mistakes made by the best-performing expert. At the end, this expert has weight . It follows, then, that the total weight is at least this much; in other words, . This inequality and the above result imply
Taking the natural logarithm of both sides yields
Now, the Taylor series of the natural logarithm is
In particular, it follows that.
Thus,
Recalling that and rearranging, it follows that
Now, as from below, the first constant tends to ; however, the second constant tends to . To quantify this relationship, define to be the penalty associated with getting a prediction wrong. Then, again applying the Taylor series of the natural logarithm,
It then follows that the mistake bound, for small , can be written in the form .
In English, the less that we penalize experts for their mistakes, the more that additional experts will lead to initial mistakes but the closer we get to capturing the predictive accuracy of the best expert as time goes on. In particular, given a sufficiently low value of and enough rounds, the randomized weighted majority algorithm can get arbitrarily close to the correct prediction rate of the best expert.
Revisiting motivation
Recall that the motivation for the randomized weighted majority algorithm was given by an example where the best expert makes a mistake 20% of the time. Precisely, in rounds, with experts, where the best expert makes mistakes, the deterministic weighted majority algorithm only guarantees an upper bound of . By the analysis above, it follows that minimizing the number of expected mistakes is equivalent to minimizing the function
Computational methods show that the optimal value is roughly , which results in the minimal worst-case number of expected mistakes of . When the number of rounds is increased (say, to ) while the accuracy rate of the best expert is kept the same the improvement can be even more dramatic; the weighted majority algorithm guarantees only a worst-case mistake rate of 48.0%, but the randomized weighted majority algorithm, when properly tuned for the optimal value of , achieves a worst-case mistake rate of 20.2%.
Uses of the randomized weighted majority algorithm
Besides directly aggregating expert predictions, the randomized weighted majority algorithm can also be used to aggregate the predictions of other prediction aggregation algorithms. In this case, the analysis above demonstrates that the RWMA can be expected to perform nearly as well as the best of the original algorithms in hindsight.
The RWMA is also particularly useful for situations where experts are making choices that cannot be combined. Consider, for example, the online shortest path problem. In this problem, a series of experts are providing directions about how to drive to a destination. Using some prediction aggregation algorithm, you choose a path without global knowledge of the graph. Afterwards, you consider how you would have done following the best expert's suggested path, and penalize accordingly. The goal is to minimize this penalty, or, in other words, to minimize the length of the final path respective to the shortest proposed path. The randomized weighted majority algorithm can be applied to this problem to minimize this penalty.
Extensions
- Multi-armed bandit problem.
- Efficient algorithm for some cases with many experts.
- Sleeping experts/"specialists" setting.
See also
References
- ^ Littlestone, N.; Warmuth, M. (1994). "The Weighted Majority Algorithm". Information and Computation. 108 (2): 212–261. doi:10.1006/inco.1994.1009.
Further reading
- Weighted Majority & Randomized Weighted Majority
- Avrim Blum (2004) machine learning theory
- Rob Schapire 2006 Foundations of Machine Learning
- Predicting From Experts Advice
- Uri Feige, Robi Krauthgamer, Moni Naor. Algorithmic Game Theory
- Nika Haghtalab 2020 Theoretical Foundations of Machine Learning (Notes)