Presentation is loading. Please wait.

Presentation is loading. Please wait.

Boosting Approach to ML

Similar presentations


Presentation on theme: "Boosting Approach to ML"β€” Presentation transcript:

1 Boosting Approach to ML
Perceptron, Margins, Kernels Maria-Florina Balcan 03/18/2015

2 Recap from last time: Boosting
General method for improving the accuracy of any given learning algorithm. Works by creating a series of challenge datasets s.t. even modest performance on these can be used to produce an overall high-accuracy predictor. Adaboost one of the top 10 ML algorithms. Works amazingly well in practice. Add a slide with Adaboost! Backed up by solid foundations.

3 Adaboost (Adaptive Boosting)
Input: S={( x 1 , 𝑦 1 ), …,( x m , 𝑦 m )}; x i βˆˆπ‘‹, 𝑦 𝑖 βˆˆπ‘Œ={βˆ’1,1} weak learning algo A (e.g., NaΓ―ve Bayes, decision stumps) For t=1,2, … ,T + + + + Construct D t on { x 1 , …, x m } + h t + Run A on D t producing h t :𝑋→{βˆ’1,1} + + - Output H final π‘₯ =sign 𝑑=1 𝛼 𝑑 β„Ž 𝑑 π‘₯ - - - - - D 1 uniform on { x 1 , …, x m } [i.e., D 1 𝑖 = 1 π‘š ] - - Given D t and h t set Add a slide with Adaboost! 𝐷 𝑑+1 𝑖 = 𝐷 𝑑 𝑖 𝑍 𝑑 e βˆ’ 𝛼 𝑑 if 𝑦 𝑖 = β„Ž 𝑑 π‘₯ 𝑖 𝐷 𝑑+1 𝑖 = 𝐷 𝑑 𝑖 𝑍 𝑑 e βˆ’ 𝛼 𝑑 𝑦 𝑖 β„Ž 𝑑 π‘₯ 𝑖 𝐷 𝑑+1 𝑖 = 𝐷 𝑑 𝑖 𝑍 𝑑 e 𝛼 𝑑 if 𝑦 𝑖 β‰  β„Ž 𝑑 π‘₯ 𝑖 𝛼 𝑑 = 1 2 ln 1βˆ’ πœ– 𝑑 πœ– 𝑑 >0 D t+1 puts half of weight on examples x i where h t is incorrect & half on examples where h t is correct

4 Nice Features of Adaboost
Very general: a meta-procedure, it can use any weak learning algorithm!!! (e.g., NaΓ―ve Bayes, decision stumps) Very fast (single pass through data each round) & simple to code, no parameters to tune. Grounded in rich theory.

5 Analyzing Training Error
Theorem πœ– 𝑑 =1/2βˆ’ 𝛾 𝑑 (error of β„Ž 𝑑 over 𝐷 𝑑 ) π‘’π‘Ÿ π‘Ÿ 𝑆 𝐻 π‘“π‘–π‘›π‘Žπ‘™ ≀ exp βˆ’2 𝑑 𝛾 𝑑 2 So, if βˆ€π‘‘, 𝛾 𝑑 β‰₯𝛾>0, then π‘’π‘Ÿ π‘Ÿ 𝑆 𝐻 π‘“π‘–π‘›π‘Žπ‘™ ≀ exp βˆ’2 𝛾 2 𝑇 The training error drops exponentially in T!!! To get π‘’π‘Ÿ π‘Ÿ 𝑆 𝐻 π‘“π‘–π‘›π‘Žπ‘™ β‰€πœ–, need only 𝑇=𝑂 1 𝛾 2 log 1 πœ– rounds Add a slide with Adaboost! Adaboost is adaptive Does not need to know 𝛾 or T a priori Can exploit 𝛾 𝑑 ≫ 𝛾

6 Generalization Guarantees
π‘’π‘Ÿ π‘Ÿ 𝑆 𝐻 π‘“π‘–π‘›π‘Žπ‘™ ≀ exp βˆ’2 𝑑 𝛾 𝑑 2 Theorem where πœ– 𝑑 =1/2βˆ’ 𝛾 𝑑 How about generalization guarantees? Original analysis [Freund&Schapire’97] H space of weak hypotheses; d=VCdim(H) 𝐻 π‘“π‘–π‘›π‘Žπ‘™ is a weighted vote, so the hypothesis class is: G={all fns of the form sign( 𝑑=1 𝑇 𝛼 𝑑 β„Ž 𝑑 (π‘₯)) } Theorem [Freund&Schapire’97] βˆ€ π‘”βˆˆπΊ, π‘’π‘Ÿπ‘Ÿ 𝑔 β‰€π‘’π‘Ÿ π‘Ÿ 𝑆 𝑔 + 𝑂 𝑇𝑑 π‘š T= # of rounds Key reason: VCdπ‘–π‘š 𝐺 = 𝑂 𝑑𝑇 plus typical VC bounds.

7 Generalization Guarantees
Theorem [Freund&Schapire’97] βˆ€ π‘”βˆˆπΊ, π‘’π‘Ÿπ‘Ÿ 𝑔 β‰€π‘’π‘Ÿ π‘Ÿ 𝑆 𝑔 + 𝑂 𝑇𝑑 π‘š where d=VCdim(H) generalization error error train error complexity T= # of rounds

8 Generalization Guarantees
Experiments showed that the test error of the generated classifier usually does not increase as its size becomes very large. Experiments showed that continuing to add new weak learners after correct classification of the training set had been achieved could further improve test set performance!!!

9 Generalization Guarantees
Experiments showed that the test error of the generated classifier usually does not increase as its size becomes very large. Experiments showed that continuing to add new weak learners after correct classification of the training set had been achieved could further improve test set performance!!! These results seem to contradict FS’97 bound and Occam’s razor (in order achieve good test error the classifier should be as simple as possible)! βˆ€ π‘”βˆˆπΊ, π‘’π‘Ÿπ‘Ÿ 𝑔 β‰€π‘’π‘Ÿ π‘Ÿ 𝑆 𝑔 + 𝑂 𝑇𝑑 π‘š

10 How can we explain the experiments?
R. Schapire, Y. Freund, P. Bartlett, W. S. Lee. present in β€œBoosting the margin: A new explanation for the effectiveness of voting methods” a nice theoretical explanation. Key Idea: Training error does not tell the whole story. We need also to consider the classification confidence!! Add a slide with Adaboost!

11 Boosting didn’t seem to overfit…(!)
…because it turned out to be increasing the margin of the classifier test error of base classifier (weak learner) test error train error Error Curve, Margin Distr. Graph - Plots from [SFBL98]

12 Classification Margin
H space of weak hypotheses. The convex hull of H: π‘π‘œ 𝐻 = 𝑓= 𝑑=1 𝑇 𝛼 𝑑 β„Ž 𝑑 , 𝛼 𝑑 β‰₯0, 𝑑=1 𝑇 𝛼 𝑑 =1, β„Ž 𝑑 ∈𝐻 Let π‘“βˆˆπ‘π‘œ 𝐻 , 𝑓= 𝑑=1 𝑇 𝛼 𝑑 β„Ž 𝑑 , 𝛼 𝑑 β‰₯0, 𝑑=1 𝑇 𝛼 𝑑 =1 . The majority vote rule 𝐻 𝑓 given by 𝑓 (given by 𝐻 𝑓 =𝑠𝑖𝑔𝑛(𝑓 π‘₯ )) predicts wrongly on example (π‘₯,𝑦) iff 𝑦𝑓 π‘₯ ≀0. Definition: margin of 𝐻 𝑓 (or of 𝑓) on example (π‘₯,𝑦) to be 𝑦𝑓(π‘₯). 𝑦𝑓 π‘₯ =𝑦 𝑑=1 𝑇 𝛼 𝑑 β„Ž 𝑑 π‘₯ = 𝑑=1 𝑇 𝑦 𝛼 𝑑 β„Ž 𝑑 π‘₯ = 𝑑:𝑦= β„Ž 𝑑 π‘₯ 𝛼 𝑑 βˆ’ 𝑑:𝑦≠ β„Ž 𝑑 π‘₯ 𝛼 𝑑 Add a slide with Adaboost! The margin is positive iff 𝑦= 𝐻 𝑓 π‘₯ . See 𝑦𝑓 π‘₯ =|𝑓 π‘₯ | as the strength or the confidence of the vote. 1 Low confidence -1 High confidence, correct High confidence, incorrect

13 Boosting and Margins Theorem:VCdim(𝐻)=𝑑, then with prob. β‰₯1βˆ’π›Ώ, βˆ€π‘“βˆˆπ‘π‘œ(𝐻), βˆ€πœƒ>0, Pr 𝐷 𝑦𝑓 π‘₯ ≀0 ≀ Pr 𝑆 𝑦𝑓 π‘₯ β‰€πœƒ +𝑂 1 π‘š d ln 2 π‘š 𝑑 πœƒ 2 + ln 1 𝛿 Note: bound does not depend on T (the # of rounds of boosting), depends only on the complex. of the weak hyp space and the margin! Add a slide with Adaboost!

14 Boosting and Margins Theorem:VCdim(𝐻)=𝑑, then with prob. β‰₯1βˆ’π›Ώ, βˆ€π‘“βˆˆπ‘π‘œ(𝐻), βˆ€πœƒ>0, Pr 𝐷 𝑦𝑓 π‘₯ ≀0 ≀ Pr 𝑆 𝑦𝑓 π‘₯ β‰€πœƒ +𝑂 1 π‘š d ln 2 π‘š 𝑑 πœƒ 2 + ln 1 𝛿 If all training examples have large margins, then we can approximate the final classifier by a much smaller classifier. Can use this to prove that better margin  smaller test error, regardless of the number of weak classifiers. Can also prove that boosting tends to increase the margin of training examples by concentrating on those of smallest margin. Add a slide with Adaboost! Although final classifier is getting larger, margins are likely to be increasing, so the final classifier is actually getting closer to a simpler classifier, driving down test error.

15 Boosting and Margins Theorem:VCdim(𝐻)=𝑑, then with prob. β‰₯1βˆ’π›Ώ, βˆ€π‘“βˆˆπ‘π‘œ(𝐻), βˆ€πœƒ>0, Pr 𝐷 𝑦𝑓 π‘₯ ≀0 ≀ Pr 𝑆 𝑦𝑓 π‘₯ β‰€πœƒ +𝑂 1 π‘š d ln 2 π‘š 𝑑 πœƒ 2 + ln 1 𝛿 Note: bound does not depend on T (the # of rounds of boosting), depends only on the complex. of the weak hyp space and the margin! Add a slide with Adaboost!

16 Boosting, Adaboost Summary
Shift in mindset: goal is now just to find classifiers a bit better than random guessing. Backed up by solid foundations. Adaboost work and its variations well in practice with many kinds of data (one of the top 10 ML algos). More about classic applications in Recitation. Relevant for big data age: quickly focuses on β€œcore difficulties”, so well-suited to distributed settings, where data must be communicated efficiently [Balcan-Blum-Fine-Mansour COLT’12]. Issues: noise. Weak learners…

17 Interestingly, the usefulness of margin recognized in Machine Learning since late 50’s.
Perceptron [Rosenblatt’57] analyzed via geometric (aka 𝐿 2 , 𝐿 2 ) margin. Original guarantee in the online learning scenario. Issues: noise. Weak learners…

18 The Perceptron Algorithm
Online Learning Model Margin Analysis Kernels Issues: noise. Weak learners…

19 The Online Learning Model
Example arrive sequentially. We need to make a prediction. Afterwards observe the outcome. For i=1, 2, …, : Online Algorithm Example π‘₯ 𝑖 Phase i: Prediction β„Ž( π‘₯ 𝑖 ) Observe c βˆ— ( π‘₯ 𝑖 ) Mistake bound model Issues: noise. Weak learners… Analysis wise, make no distributional assumptions. Goal: Minimize the number of mistakes.

20 The Online Learning Model. Motivation
- classification (distribution of both spam and regular mail changes over time, but the target function stays fixed - last year's spam still looks like spam). - Recommendation systems. Recommending movies, etc. - Predicting whether a user will be interested in a new news article or not. - Add placement in a new market. Issues: noise. Weak learners…

21 Linear Separators w Instance space X= R d
Hypothesis class of linear decision surfaces in R d . h x =wβ‹… x + w 0 , if β„Ž π‘₯ β‰₯ 0, then label x as +, otherwise label it as - Claim: WLOG w 0 =0. Proof: Can simulate a non-zero threshold with a dummy input feature π‘₯ 0 that is always set up to 1. Issues: noise. Weak learners… π‘₯= π‘₯ 1 , …, π‘₯ 𝑑 β†’ π‘₯ = π‘₯ 1 , …, π‘₯ 𝑑 ,1 wβ‹… x + w 0 β‰₯0 iff 𝑀 1 ,…, 𝑀 𝑑 , w 0 β‹… π‘₯ β‰₯0 where w= 𝑀 1 ,…, 𝑀 𝑑

22 Linear Separators: Perceptron Algorithm
Set t=1, start with the all zero vector 𝑀 1 . Given example π‘₯, predict positive iff 𝑀 𝑑 β‹…π‘₯β‰₯0 On a mistake, update as follows: Mistake on positive, then update 𝑀 𝑑+1 ← 𝑀 𝑑 +π‘₯ Mistake on negative, then update 𝑀 𝑑+1 ← 𝑀 𝑑 βˆ’π‘₯ Note: 𝑀 𝑑 is weighted sum of incorrectly classified examples Issues: noise. Weak learners… 𝑀 𝑑 = π‘Ž 𝑖 1 π‘₯ 𝑖 1 +…+ π‘Ž 𝑖 π‘˜ π‘₯ 𝑖 π‘˜ 𝑀 𝑑 β‹…π‘₯= π‘Ž 𝑖 1 π‘₯ 𝑖 1 β‹…π‘₯+…+ π‘Ž 𝑖 π‘˜ π‘₯ 𝑖 π‘˜ β‹…π‘₯ Important when we talk about kernels.

23 Perceptron Algorithm: Example
βˆ’1,2 βˆ’ X  - 1,0 + 1,1 + X +  βˆ’1,0 βˆ’ - + βˆ’1,βˆ’2 βˆ’ X  + 1,βˆ’1 + - Algorithm: Set t=1, start with all-zeroes weight vector 𝑀 1 . Given example π‘₯, predict positive iff 𝑀 𝑑 β‹…π‘₯β‰₯0. On a mistake, update as follows: Mistake on positive, update 𝑀 𝑑+1 ← 𝑀 𝑑 +π‘₯ Mistake on negative, update 𝑀 𝑑+1 ← 𝑀 𝑑 βˆ’π‘₯ 𝑀 1 =(0,0) 𝑀 2 = 𝑀 1 βˆ’ βˆ’1,2 =(1,βˆ’2) 𝑀 3 = 𝑀 2 + 1,1 =(2,βˆ’1) 𝑀 4 = 𝑀 3 βˆ’ βˆ’1,βˆ’2 =(3,1)

24 Geometric Margin Definition: The margin of example π‘₯ w.r.t. a linear sep. 𝑀 is the distance from π‘₯ to the plane 𝑀⋅π‘₯=0 (or the negative if on wrong side) π‘₯ 1 w Margin of positive example π‘₯ 1 π‘₯ 2 Margin of negative example π‘₯ 2

25 Geometric Margin Definition: The margin of example π‘₯ w.r.t. a linear sep. 𝑀 is the distance from π‘₯ to the plane 𝑀⋅π‘₯=0 (or the negative if on wrong side) Definition: The margin 𝛾 𝑀 of a set of examples 𝑆 wrt a linear separator 𝑀 is the smallest margin over points π‘₯βˆˆπ‘†. + - 𝛾 𝑀 w

26 Geometric Margin Definition: The margin of example π‘₯ w.r.t. a linear sep. 𝑀 is the distance from π‘₯ to the plane 𝑀⋅π‘₯=0 (or the negative if on wrong side) Definition: The margin 𝛾 𝑀 of a set of examples 𝑆 wrt a linear separator 𝑀 is the smallest margin over points π‘₯βˆˆπ‘†. Definition: The margin 𝛾 of a set of examples 𝑆 is the maximum 𝛾 𝑀 over all linear separators 𝑀. + - 𝛾 w

27 Perceptron: Mistake Bound
Theorem: If data has margin 𝛾 and all points inside a ball of radius 𝑅, then Perceptron makes ≀ 𝑅/𝛾 2 mistakes. (Normalized margin: multiplying all points by 100, or dividing all points by 100, doesn’t change the number of mistakes; algo is invariant to scaling.) + w* -  R

28 Perceptron Algorithm: Analysis
Theorem: If data has margin 𝛾 and all points inside a ball of radius 𝑅, then Perceptron makes ≀ 𝑅/𝛾 2 mistakes. Update rule: Mistake on positive: 𝑀 𝑑+1 ← 𝑀 𝑑 +π‘₯ Mistake on negative: 𝑀 𝑑+1 ← 𝑀 𝑑 βˆ’π‘₯ Proof: Idea: analyze 𝑀 𝑑 β‹… 𝑀 βˆ— and β€– 𝑀 𝑑 β€–, where 𝑀 βˆ— is the max-margin sep, β€– 𝑀 βˆ— β€–=1. Claim 1: 𝑀 𝑑+1 β‹… 𝑀 βˆ— β‰₯ 𝑀 𝑑 β‹… 𝑀 βˆ— +𝛾. (because 𝑙 π‘₯ π‘₯β‹… 𝑀 βˆ— β‰₯𝛾) Claim 2: 𝑀 𝑑 ≀ 𝑀 𝑑 𝑅 2 . (by Pythagorean Theorem) 𝑀 𝑑 𝑀 𝑑+1 π‘₯ After 𝑀 mistakes: 𝑀 𝑀+1 β‹… 𝑀 βˆ— β‰₯𝛾𝑀 (by Claim 1) 𝑀 𝑀+1 ≀𝑅 𝑀 (by Claim 2) 𝑀 βˆ— 𝑀 𝑀+1 𝑀 𝑀+1 β‹… 𝑀 βˆ— ≀‖ 𝑀 𝑀+1 β€– (since 𝑀 βˆ— is unit length) So, 𝛾𝑀≀𝑅 𝑀 , so 𝑀≀ 𝑅 𝛾 2 .

29 Perceptron Extensions
Can use it to find a consistent separator (by cycling through the data). One can convert the mistake bound guarantee into a distributional guarantee too (for the case where the π‘₯ 𝑖 s come from a fixed distribution). Can be adapted to the case where there is no perfect separator as long as the so called hinge loss (i.e., the total distance needed to move the points to classify them correctly large margin) is small. Can be kernelized to handle non-linear decision boundaries!

30 Perceptron Discussion
Simple online algorithm for learning linear separators with a nice guarantee that depends only on the geometric (aka 𝐿 2 , 𝐿 2 ) margin. It can be kernelized to handle non-linear decision boundaries --- see next class! Simple, but very useful in applications like Branch prediction; it also has interesting extensions to structured prediction.


Download ppt "Boosting Approach to ML"

Similar presentations


Ads by Google