Docsity

Weighted Majority Algorithm, Mistake Bound Model, and Winnow Algorithm for Online Learning, Study notes of Advanced Algorithms

Toggle sidebar
bg1
CS787: Advanced Algorithms
Scribe: Archit Gupta, Pavan Kuppili Lecturer: Shuchi Chawla
Topic: Weighted Majority, Mistake Bound Model, and Winnow Algorithm Date: 11/12/2007
23.1 Prediction Problem
Last class we looked at the technique of maximizing reward using Multiplicative Update technique.
Today we look at a similar problem for online learning, where our goal is to minimize costs.
Let there be nexperts giving predictions whether it’ll rain or not. Expert ipredicts pi∈ {−1,1}
where pi= 1 if the prediction is it’ll rain and vice versa. Each expert iis associated with a weight wi.
Now we have to decide whether it’ll rain. Earlier on, we picked an expert to bet on. Note that
instead of picking an expert with probability proportional to wi, here we take a weighted vote of
experts. This algorithm is called the Weighted Majority algorithm.
Algorithm: Let wi= 1 at time t= 0. After each instance ‘t’ of a prediction, for each of the
expert i, that make a mistake: wi←wi(1 −).
To predict the next event t+ 1, we take the weighted vote of the experts.
We pick value 1 if P(wipi)>0
We pick value -1 if P(wipi)<0,
where wiis the weight associated with the expert iand piis the prediction made by the expert i.
23.1.1 General case
We can generalize the above problem by letting the costs take any continuous value between 0 and
1. Now, each expert imakes a prediction pi,t which can lead to a loss li,t ∈[0,1] at time tof the
prediction. Our goal remains to minimize our costs.
Let wi,t be the weight of expert iat time t,li,t be the loss of expert iat time t, and let Wt
be the total weight of all experts at time t. The algorithm is as follows.
Algorithm:
For each expert initialize wi,0= 1.
At each step, pick expert iwith prob. wi,t
Wt, where Wt=Pi(wi,t)
Update wi,t+1 =wi,t(1 −)li,t where li,t is the loss of expert i.
Claim 23.1.1 WT≥(1 −)L, where Tis the final time step, and Lis the total loss of the best
expert.
Proof: Let nbe the total number of experts, and let jbe the best expert. So WT=Pn
i=1 wi,T ≥
wj,T = (1 −)L.
1
pf3
pf4
pf5

Partial preview of the text

Download Weighted Majority Algorithm, Mistake Bound Model, and Winnow Algorithm for Online Learning and more Study notes Advanced Algorithms in PDF only on Docsity!

CS787: Advanced Algorithms Scribe: Archit Gupta, Pavan Kuppili Lecturer: Shuchi Chawla Topic: Weighted Majority, Mistake Bound Model, and Winnow Algorithm Date: 11/12/

23.1 Prediction Problem

Last class we looked at the technique of maximizing reward using Multiplicative Update technique. Today we look at a similar problem for online learning, where our goal is to minimize costs. Let there be n experts giving predictions whether it’ll rain or not. Expert i predicts pi ∈ {− 1 , 1 } where pi = 1 if the prediction is it’ll rain and vice versa. Each expert i is associated with a weight wi.

Now we have to decide whether it’ll rain. Earlier on, we picked an expert to bet on. Note that instead of picking an expert with probability proportional to wi, here we take a weighted vote of experts. This algorithm is called the Weighted Majority algorithm.

Algorithm: Let wi = 1 at time t = 0. After each instance ‘t’ of a prediction, for each of the expert i, that make a mistake: wi ← wi(1 − ). To predict the next event t + 1, we take the weighted vote of the experts. We pick value 1 if

(wipi) > 0 We pick value -1 if

(wipi) < 0, where wi is the weight associated with the expert i and pi is the prediction made by the expert i.

23.1.1 General case

We can generalize the above problem by letting the costs take any continuous value between 0 and

  1. Now, each expert i makes a prediction pi,t which can lead to a loss li,t ∈ [0, 1] at time t of the prediction. Our goal remains to minimize our costs.

Let wi,t be the weight of expert i at time t, li,t be the loss of expert i at time t, and let Wt be the total weight of all experts at time t. The algorithm is as follows.

Algorithm: For each expert initialize wi, 0 = 1. At each step, pick expert i with prob. w Wi,tt , where Wt =

i(wi,t) Update wi,t+1 = wi,t(1 − )li,t^ where li,t is the loss of expert i.

Claim 23.1.1 WT ≥ (1 − )L, where T is the final time step, and L is the total loss of the best expert.

Proof: Let n be the total number of experts, and let j be the best expert. So WT =

∑n i=1 wi,T^ ≥ wj,T = (1 − )L.

Let Ft be the expected cost of the algorithm at time t. So Ft =

i

wi,tli,t Wt Our total expected cost =

t

i

wi,tli,t Wt Now let us get a relation between Ft and WT , so that using claim 1, we can get a relationship between Ft and L.

Wt+1 =

i

wi,t(1 − )li,t

i

wi,t(1 − li,t)

i

wi,t − 

i

wi,tli,t

= Wt − WtFt Wt+1 ≤ Wt(1 − Ft)

This gives, WT ≤ n

t

(1 − Ft)

Using claim 1, (1 − )L^ ≤ n

t

(1 − Ft)

L log(1 − ) ≤ log n +

t

log(1 − Ft)

(Note that log(1 + x) ≤ x)

L log(1 − ) ≤ log n − 

t

Ft

∑

t

Ft ≤ −L log(1 − )/ + log n/

If  is small, using Taylor’s series expansion, we get our total expected cost =

t Ft^ ≈^ (1 + /2)L + log n/ If instead of loss we were to gain G, the equivalent equation becomes

t Ft^ ≤ (1 − /2)G − 1 / log n Now, let  =

log n/L. If L is large enough,  is small and we get, ∑

t

Ft ≈ L + O(

L log n)

This is a good result as our expected cost is within an additive term of O(

L log n) of the best expert.

  1. Keep repeating steps 2 and 3 for each example on which we need to make predictions.

Theorem 23.3.1 The number of mistakes made by the above mistake bound algorithm on the concpt class of OR functions ≤ n, where n is the number of attributes.

Proof: It can be noted that we maintain the invariant that L is a superset of all the attributes in the true expert. If an example contains atleast one attribute in the true expert, the example is true, and we also predict true. We never end up removing an attribute in the true expert. However an example might be false, and we might predict it as true. (For example in the beginning, when we have all the attributes in L). However, each time we make a mistake, we remove atleast one at- tribute. So we make atmost n mistakes before we elminate all the attributes not in the true expert.

23.3.2 Concept class of OR functions of maximum size k

Here, |C| =

∑k i=

(n k

≈ nk. So, we want a mistake bound model which has a maximum of O(k log n) mistakes. Let A be the set of n attributes. Let wi be the weight of the ith^ attribute which we keep updating. In any example, let xi = 1, if the example contains the ith^ attribute, and xi = 0, otherwise. The following Winnow algorithm makes a maximum of O(klogn) mistakes.

Winnow algorithm:

  1. Initialize wi = 1, ∀i ∈ A.
  2. If

i wixi^ ≥^ n, predict positive, else predict negative.

  1. On a mistake, if the true label was positive, wi = 2wi, ∀ attributes i present in the example.
  2. On a mistake, if the true label was negative, wi = w 2 i , ∀ attributes i present in the example.
  3. Keep repeating steps 2, 3, and 4 on all incoming examples on which we need to make predictions.

Claim 23.3.2 Let P be the number of mistakes made on positive examples (the true label on the example is positive). P ≤ k log 2 n.

Proof: Let us focus on any particular attribute j in the true expert. Whenever we make a mistake on an example containing the attribute j, we double the weight of that attribute. So we make atmost log 2 n mistakes on positive examples containg attribute j before wj becomes more than n, and from then on we do not make any mistakes on positive examples containg attribute j. Since we have atmost k such attributes in the true expert, we make atmost klog 2 n mistakes before we stop making mistakes on positive examples.

Claim 23.3.3 Let N be the number of mistakes made on negative examples (the true label on the example is negative). N ≤ 2 P + 2.

Proof: Whenever we make a mistake on a positive example (the sum of weights on attributes in that example < n), the increase in sum of weights is atmost n. Likewise when we make a mistake on

a negative example (the sum of weights on attributes in that example ≥ n), the reduction in sum of weights ≥ n 2. The initial sum of weights of attributes is n. After P mistakes on positive examples, and N mistakes on negative examples, the sum of weights of all attributes ≤ n + nP − n 2 N. The total weight never falls below 0. So, n + nP − n 2 N ≥ 0. So, N ≤ 2 P + 2.

Theorem 23.3.4 The bound on total number of mistakes is O(k log n) using the above two claims.

23.4 r out of k Concept Class

Here the true expert again has k attributes, and if any r of them are present in the example, then the example is true, else false. In the next class, we will see how the Winnow algorithm (using a multiplicative factor of (1 + ) instead of 2) can be used to get a mistake bound of O(krlogn) (using  = (^21) r ).