A Decision Stump. Decision Trees, cont. Boosting. Machine Learning 10701/15781 Carlos Guestrin Carnegie Mellon University. October 1 st, 2007

Similar documents
Decision Trees. Machine Learning 10701/15781 Carlos Guestrin Carnegie Mellon University. February 5 th, Carlos Guestrin 1

Decision Trees. Machine Learning CSEP546 Carlos Guestrin University of Washington. February 3, 2014

Voting (Ensemble Methods)

Generative v. Discriminative classifiers Intuition

Stochastic Gradient Descent

Boos$ng Can we make dumb learners smart?

Decision Trees Lecture 12

ECE 5984: Introduction to Machine Learning

ECE 5424: Introduction to Machine Learning

VBM683 Machine Learning

Boosting. CAP5610: Machine Learning Instructor: Guo-Jun Qi

Decision Trees: Overfitting

Introduction to Machine Learning CMU-10701

PAC-learning, VC Dimension and Margin-based Bounds

CS6375: Machine Learning Gautam Kunapuli. Decision Trees

CSE 417T: Introduction to Machine Learning. Final Review. Henry Chai 12/4/18

Bias-Variance Tradeoff

10-701/ Machine Learning - Midterm Exam, Fall 2010

CS7267 MACHINE LEARNING

Learning Theory. Machine Learning CSE546 Carlos Guestrin University of Washington. November 25, Carlos Guestrin

Logistic Regression. Machine Learning Fall 2018

the tree till a class assignment is reached

PAC-learning, VC Dimension and Margin-based Bounds

Learning with multiple models. Boosting.

Machine Learning CSE546 Carlos Guestrin University of Washington. September 30, 2013

BBM406 - Introduc0on to ML. Spring Ensemble Methods. Aykut Erdem Dept. of Computer Engineering HaceDepe University

Machine Learning, Midterm Exam: Spring 2009 SOLUTION

10701/15781 Machine Learning, Spring 2007: Homework 2

Decision Trees. CSC411/2515: Machine Learning and Data Mining, Winter 2018 Luke Zettlemoyer, Carlos Guestrin, and Andrew Moore

Naïve Bayes Introduction to Machine Learning. Matt Gormley Lecture 18 Oct. 31, 2018

Machine Learning. Ensemble Methods. Manfred Huber

Decision Trees (Cont.)

ML (cont.): DECISION TREES

Chapter 14 Combining Models

CS229 Supplemental Lecture notes

Decision Tree Learning

Machine Learning CSE546 Carlos Guestrin University of Washington. September 30, What about continuous variables?

Learning Theory Continued

Ensembles. Léon Bottou COS 424 4/8/2010

Announcements Kevin Jamieson

Generative v. Discriminative classifiers Intuition

MIDTERM SOLUTIONS: FALL 2012 CS 6375 INSTRUCTOR: VIBHAV GOGATE

Machine Learning Gaussian Naïve Bayes Big Picture

Bias-Variance in Machine Learning

Machine Learning

Boosting. Ryan Tibshirani Data Mining: / April Optional reading: ISL 8.2, ESL , 10.7, 10.13

COS 402 Machine Learning and Artificial Intelligence Fall Lecture 3: Learning Theory

Introduction to Machine Learning Midterm, Tues April 8

Decision Tree Learning Lecture 2

Machine Learning Tom M. Mitchell Machine Learning Department Carnegie Mellon University. September 20, 2012

Machine Learning

Machine Learning

Decision Trees. CSC411/2515: Machine Learning and Data Mining, Winter 2018 Luke Zettlemoyer, Carlos Guestrin, and Andrew Moore

Machine Learning Ensemble Learning I Hamid R. Rabiee Jafar Muhammadi, Alireza Ghasemi Spring /

Machine Learning

FINAL: CS 6375 (Machine Learning) Fall 2014

Discriminative v. generative

EE 511 Online Learning Perceptron

CS534 Machine Learning - Spring Final Exam

Learning Ensembles. 293S T. Yang. UCSB, 2017.

Classification: The rest of the story

Ensemble Methods. Charles Sutton Data Mining and Exploration Spring Friday, 27 January 12

Last Time. Today. Bayesian Learning. The Distributions We Love. CSE 446 Gaussian Naïve Bayes & Logistic Regression

Midterm, Fall 2003

Lecture 24: Other (Non-linear) Classifiers: Decision Tree Learning, Boosting, and Support Vector Classification Instructor: Prof. Ganesh Ramakrishnan

Outline: Ensemble Learning. Ensemble Learning. The Wisdom of Crowds. The Wisdom of Crowds - Really? Crowd wiser than any individual

Ensemble Methods for Machine Learning

Notes on Machine Learning for and

CS145: INTRODUCTION TO DATA MINING

Machine Learning, Fall 2009: Midterm

ECE 5984: Introduction to Machine Learning

Introduction to Machine Learning Midterm Exam

Decision Trees. Nicholas Ruozzi University of Texas at Dallas. Based on the slides of Vibhav Gogate and David Sontag

Generative v. Discriminative classifiers Intuition

CSE 151 Machine Learning. Instructor: Kamalika Chaudhuri

MIDTERM: CS 6375 INSTRUCTOR: VIBHAV GOGATE October,

C4.5 - pruning decision trees

Learning Decision Trees

Gradient Boosting (Continued)

Decision Trees. Data Science: Jordan Boyd-Graber University of Maryland MARCH 11, Data Science: Jordan Boyd-Graber UMD Decision Trees 1 / 1

Machine Learning, Midterm Exam

Lecture 8. Instructor: Haipeng Luo

Machine learning comes from Bayesian decision theory in statistics. There we want to minimize the expected value of the loss function.

Data Mining und Maschinelles Lernen

Boosting. Acknowledgment Slides are based on tutorials from Robert Schapire and Gunnar Raetsch

Generalization, Overfitting, and Model Selection

CS 6375 Machine Learning

Machine Learning, Midterm Exam: Spring 2008 SOLUTIONS. Q Topic Max. Score Score. 1 Short answer questions 20.

Machine Learning Recitation 8 Oct 21, Oznur Tastan

PAC Learning Introduction to Machine Learning. Matt Gormley Lecture 14 March 5, 2018

Data Mining: Concepts and Techniques. (3 rd ed.) Chapter 8. Chapter 8. Classification: Basic Concepts

Machine Learning

Midterm Exam Solutions, Spring 2007

Learning theory. Ensemble methods. Boosting. Boosting: history

Generalization, Overfitting, and Model Selection

Statistical Machine Learning from Data

Classification and Regression Trees

Classification CE-717: Machine Learning Sharif University of Technology. M. Soleymani Fall 2012

Harrison B. Prosper. Bari Lectures

Midterm Review CS 6375: Machine Learning. Vibhav Gogate The University of Texas at Dallas

Transcription:

Decision Trees, cont. Boosting Machine Learning 10701/15781 Carlos Guestrin Carnegie Mellon University October 1 st, 2007 1 A Decision Stump 2 1

The final tree 3 Basic Decision Tree Building Summarized BuildTree(DataSet,Output) If all output values are the same in DataSet, return a leaf node that says predict this unique output If all input values are the same, return a leaf node that says predict the majority output Else find attribute X with highest Info Gain Suppose X has n X distinct values (i.e. X has arity n X ). Create and return a non-leaf node with n X children. The i th child should be built by calling BuildTree(DS i,output) Where DS i built consists of all those records in DataSet for which X = ith distinct value of X. 4 2

MPG Test set error 5 MPG Test set error The test set error is much worse than the training set error why? 6 3

Decision trees & Learning Bias mpg cylinders displacement horsepower weight acceleration modelyear maker good 4 low low low high 75to78 asia bad 6 medium medium medium medium 70to74 america bad 4 medium medium medium low 75to78 europe bad 8 high high high low 70to74 america bad 6 medium medium medium medium 70to74 america bad 4 low medium low medium 70to74 asia bad 4 low medium low low 70to74 asia bad 8 high high high low 75to78 america : : : : : : : : : : : : : : : : : : : : : : : : bad 8 high high high low 70to74 america good 8 high medium high high 79to83 america bad 8 high high high low 75to78 america good 4 low low low low 79to83 america bad 6 medium medium medium high 75to78 america good 4 medium low low low 79to83 america good 4 low low medium high 79to83 america bad 8 high high high low 70to74 america good 4 low medium low medium 75to78 europe bad 5 medium medium medium medium 75to78 europe 7 Decision trees will overfit Standard decision trees are have no learning biased Training set error is always zero! (If there is no label noise) Lots of variance Will definitely overfit!!! Must bias towards simpler trees Many strategies for picking simpler trees: Fixed depth Fixed number of leaves Or something smarter 8 4

Consider this split 9 A chi-square test Suppose that mpg was completely uncorrelated with maker. What is the chance we d have seen data of at least this apparent level of association anyway? 10 5

A chi-square test Suppose that mpg was completely uncorrelated with maker. What is the chance we d have seen data of at least this apparent level of association anyway? By using a particular kind of chi-square test, the answer is 7.2% (Such simple hypothesis tests are very easy to compute, unfortunately, not enough time to cover in the lecture, but in your homework, you ll have fun! :)) 11 Using Chi-squared to avoid overfitting Build the full decision tree as before But when you can grow it no more, start to prune: Beginning at the bottom of the tree, delete splits in which p chance > MaxPchance Continue working you way up until there are no more prunable nodes MaxPchance is a magic parameter you must specify to the decision tree, indicating your willingness to risk fitting noise 12 6

Pruning example With MaxPchance = 0.1, you will see the following MPG decision tree: Note the improved test set accuracy compared with the unpruned tree 13 MaxPchance Technical note MaxPchance is a regularization parameter that helps us bias towards simpler models Expected Test set Error Decreasing MaxPchance Increasing High Bias High Variance We ll learn to choose the value of these magic parameters soon! 14 7

Real-Valued inputs What should we do if some of the inputs are real-valued? mpg cylinders displacemen horsepower weight acceleration modelyear maker good 4 97 75 2265 18.2 77 asia bad 6 199 90 2648 15 70 america bad 4 121 110 2600 12.8 77 europe bad 8 350 175 4100 13 73 america bad 6 198 95 3102 16.5 74 america bad 4 108 94 2379 16.5 73 asia bad 4 113 95 2228 14 71 asia bad 8 302 139 3570 12.8 78 america : : : : : : : : : : : : : : : : : : : : : : : : good 4 120 79 2625 18.6 82 america bad 8 455 225 4425 10 70 america good 4 107 86 2464 15.5 76 europe bad 5 131 103 2830 15.9 78 europe Infinite number of possible split values!!! Finite dataset, only finite number of relevant splits! Idea One: Branch on each possible real value 15 One branch for each numeric value idea: Hopeless: with such high branching factor will shatter the dataset and overfit 16 8

Threshold splits Binary tree, split on attribute X One branch: X < t Other branch: X t 17 Choosing threshold split Binary tree, split on attribute X One branch: X < t Other branch: X t Search through possible values of t Seems hard!!! But only finite number of t s are important Sort data according to X into {x 1,,x m } Consider split points of the form x i + (x i+1 x i )/2 18 9

A better idea: thresholded splits Suppose X is real valued Define IG(Y X:t) as H(Y) - H(Y X:t) Define H(Y X:t) = H(Y X < t) P(X < t) + H(Y X >= t) P(X >= t) IG(Y X:t) is the information gain for predicting Y if all you know is whether X is greater than or less than t Then define IG*(Y X) = max t IG(Y X:t) For each real-valued attribute, use IG*(Y X) for assessing its suitability as a split Note, may split on an attribute multiple times, with different thresholds 19 Example with MPG 20 10

Example tree using reals 21 What you need to know about decision trees Decision trees are one of the most popular data mining tools Easy to understand Easy to implement Easy to use Computationally cheap (to solve heuristically) Information gain to select attributes (ID3, C4.5, ) Presented for classification, can be used for regression and density estimation too Decision trees will overfit!!! Zero bias classifier! Lots of variance Must use tricks to find simple trees, e.g., Fixed depth/early stopping Pruning Hypothesis testing 22 11

Acknowledgements Some of the material in the decision trees presentation is courtesy of Andrew Moore, from his excellent collection of ML tutorials: http://www.cs.cmu.edu/~awm/tutorials 23 Announcements Homework 1 due Wednesday beginning of class started early, started early, started early, started early, started early, started early, started early, started early Exam dates set: Midterm: Thursday, Oct. 25th, 5-6:30pm, MM A14 Final: Tuesday, Dec. 11, 05:30PM-08:30PM 24 12

Fighting the bias-variance tradeoff Simple (a.k.a. weak) learners are good e.g., naïve Bayes, logistic regression, decision stumps (or shallow decision trees) Low variance, don t usually overfit Simple (a.k.a. weak) learners are bad High bias, can t solve hard learning problems Can we make weak learners always good??? No!!! But often yes 25 Voting (Ensemble Methods) Instead of learning a single (weak) classifier, learn many weak classifiers that are good at different parts of the input space Output class: (Weighted) vote of each classifier Classifiers that are most sure will vote with more conviction Classifiers will be most sure about a particular part of the space On average, do better than single classifier! But how do you??? force classifiers to learn about different parts of the input space? weigh the votes of different classifiers? 26 13

Boosting [Schapire, 1989] Idea: given a weak learner, run it multiple times on (reweighted) training data, then let learned classifiers vote On each iteration t: weight each training example by how incorrectly it was classified Learn a hypothesis h t A strength for this hypothesis α t Final classifier: Practically useful Theoretically interesting 27 Learning from weighted data Sometimes not all data points are equal Some data points are more equal than others Consider a weighted dataset D(i) weight of i th training example (x i,y i ) Interpretations: i th training example counts as D(i) examples If I were to resample data, I would get more samples of heavier data points Now, in all calculations, whenever used, i th training example counts as D(i) examples e.g., MLE for Naïve Bayes, redefine Count(Y=y) to be weighted count 28 14

29 30 15

What α t to choose for hypothesis h t? Training error of final classifier is bounded by: [Schapire, 1989] Where 31 What α t to choose for hypothesis h t? Training error of final classifier is bounded by: [Schapire, 1989] Where 32 16

What α t to choose for hypothesis h t? Training error of final classifier is bounded by: [Schapire, 1989] Where If we minimize t Z t, we minimize our training error We can tighten this bound greedily, by choosing α t and h t on each iteration to minimize Z t. 33 What α t to choose for hypothesis h t? [Schapire, 1989] We can minimize this bound by choosing α t on each iteration to minimize Z t. For boolean target function, this is accomplished by [Freund & Schapire 97]: You ll prove this in your homework! 34 17

Strong, weak classifiers If each classifier is (at least slightly) better than random ε t < 0.5 AdaBoost will achieve zero training error (exponentially fast): Is it hard to achieve better than random training error? 35 Boosting results Digit recognition [Schapire, 1989] Boosting often Robust to overfitting Test set error decreases even after training error is zero 36 18

Boosting generalization error bound [Freund & Schapire, 1996] T number of boosting rounds d VC dimension of weak learner, measures complexity of classifier m number of training examples 37 Boosting generalization error bound [Freund & Schapire, 1996] Contradicts: Boosting often Robust to overfitting Test set error decreases even after training error is zero Need better analysis tools we ll come back to this later in the semester T number of boosting rounds d VC dimension of weak learner, measures complexity of classifier m number of training examples 38 19

Boosting: Experimental Results [Freund & Schapire, 1996] Comparison of C4.5, Boosting C4.5, Boosting decision stumps (depth 1 trees), 27 benchmark datasets error error error 39 40 20

Boosting and Logistic Regression Logistic regression assumes: And tries to maximize data likelihood: Equivalent to minimizing log loss 41 Boosting and Logistic Regression Logistic regression equivalent to minimizing log loss Boosting minimizes similar loss function!! Both smooth approximations of 0/1 loss! 42 21

Logistic regression and Boosting Logistic regression: Minimize loss fn Boosting: Minimize loss fn Define Define where x j predefined where h t (x i ) defined dynamically to fit data (not a linear classifier) Weights α j learned incrementally 43 What you need to know about Boosting Combine weak classifiers to obtain very strong classifier Weak classifier slightly better than random on training data Resulting very strong classifier can eventually provide zero training error AdaBoost algorithm Boosting v. Logistic Regression Similar loss functions Single optimization (LR) v. Incrementally improving classification (B) Most popular application of Boosting: Boosted decision stumps! Very simple to implement, very effective classifier 44 22