Decision Trees an introduction.

Slides:



Advertisements
Similar presentations
Decision Tree Approach in Data Mining
Advertisements

Introduction Training Complexity, Pruning CART vs. ID3 vs. C4.5
Classification Techniques: Decision Tree Learning
Naïve Bayes: discussion
Decision Trees.
Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei Han.
Decision Tree Algorithm
Constructing Decision Trees. A Decision Tree Example The weather data example. ID codeOutlookTemperatureHumidityWindyPlay abcdefghijklmnabcdefghijklmn.
1 Classification with Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Classification: Decision Trees
1 Classification with Decision Trees I Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Decision Trees an Introduction.
Inferring rudimentary rules
Classification: Decision Trees 2 Outline  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain and Gain Ratio.
Machine Learning Lecture 10 Decision Trees G53MLE Machine Learning Dr Guoping Qiu1.
SEEM Tutorial 2 Classification: Decision tree, Naïve Bayes & k-NN
Induction of Decision Trees Blaž Zupan and Ivan Bratko magix.fri.uni-lj.si/predavanja/uisp.
Fall 2004 TDIDT Learning CS478 - Machine Learning.
Learning what questions to ask. 8/29/03Decision Trees2  Job is to build a tree that represents a series of questions that the classifier will ask of.
Classification I. 2 The Task Input: Collection of instances with a set of attributes x and a special nominal attribute Y called class attribute Output:
Lecture 7. Outline 1. Overview of Classification and Decision Tree 2. Algorithm to build Decision Tree 3. Formula to measure information 4. Weka, data.
Inferring Decision Trees Using the Minimum Description Length Principle J. R. Quinlan and R. L. Rivest Information and Computation 80, , 1989.
Decision Tree Learning Debapriyo Majumdar Data Mining – Fall 2014 Indian Statistical Institute Kolkata August 25, 2014.
Data Mining Practical Machine Learning Tools and Techniques Chapter 4: Algorithms: The Basic Methods Section 4.3: Decision Trees Rodney Nielsen Many of.
Data Mining – Algorithms: Decision Trees - ID3 Chapter 4, Section 4.3.
CS690L Data Mining: Classification
MACHINE LEARNING 10 Decision Trees. Motivation  Parametric Estimation  Assume model for class probability or regression  Estimate parameters from all.
Decision Trees, Part 1 Reading: Textbook, Chapter 6.
1 Classification with Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Decision Trees.
Machine Learning Recitation 8 Oct 21, 2009 Oznur Tastan.
SEEM Tutorial 1 Classification: Decision tree Siyuan Zhang,
Decision Trees by Muhammad Owais Zahid
Chapter 3 Data Mining: Classification & Association Chapter 4 in the text box Section: 4.3 (4.3.1),
Data Mining Chapter 4 Algorithms: The Basic Methods - Constructing decision trees Reporter: Yuen-Kuei Hsueh Date: 2008/7/24.
Review of Decision Tree Learning Bamshad Mobasher DePaul University Bamshad Mobasher DePaul University.
CSE573 Autumn /11/98 Machine Learning Administrative –Finish this topic –The rest of the time is yours –Final exam Tuesday, Mar. 17, 2:30-4:20.
Induction of Decision Trees Blaž Zupan and Ivan Bratko magix.fri.uni-lj.si/predavanja/uisp.
Induction of Decision Trees
DECISION TREES An internal node represents a test on an attribute.
Chapter 18 From Data to Knowledge
Decision Tree Learning
Computational Intelligence: Methods and Applications
Algorithms for Classification:
Classification Algorithms
Teori Keputusan (Decision Theory)
Prepared by: Mahmoud Rafeek Al-Farra
Decision Trees: Another Example
Artificial Intelligence
Ch9: Decision Trees 9.1 Introduction A decision tree:
ID3 Vlad Dumitriu.
Data Science Algorithms: The Basic Methods
Decision Tree Saed Sayad 9/21/2018.
Classification and Prediction
Advanced Artificial Intelligence
ID3 Algorithm.
Jianping Fan Dept of Computer Science UNC-Charlotte
Clustering.
Machine Learning Chapter 3. Decision Tree Learning
Machine Learning: Lecture 3
Classification with Decision Trees
Machine Learning Chapter 3. Decision Tree Learning
Induction of Decision Trees
Dept. of Computer Science University of Liverpool
Machine Learning in Practice Lecture 17
Data Mining(中国人民大学) Yang qiang(香港科技大学) Han jia wei(UIUC)
Junheng, Shengming, Yunsheng 10/19/2018
Data Mining CSCI 307, Spring 2019 Lecture 15
Data Mining CSCI 307, Spring 2019 Lecture 6
Data Mining CSCI 307, Spring 2019 Lecture 9
Presentation transcript:

Decision Trees an introduction

Entropy over the class attribute A class attribute contains uncertainty over the values uncertainty captured by entropy H(p) of the target Increase certainty about the class by considering other attributes Conditioning (splitting) on an informative attribute produces splits with lower entropy information gain: entropy before split compared to entropy after split

Decision tree An internal node is a test on an attribute A branch represents an outcome of the test, e.g., house = Rent A leaf node represents a class label or class label distribution At each node, one attribute is chosen to split training examples into distinct classes as much as possible A new case is classified by following a matching path to a leaf node Rent Buy Other Age < 35 Age ≥ 35 Price < 200K Price ≥ 200K Yes No

Weather data: play tennis or not Outlook Temperature Humidity Windy Play? sunny hot high false No true overcast Yes rain mild cool normal

Example tree for “play tennis”

Building decision tree, Quinlan 1993 Top-down tree construction At start, all training examples are at the root Partition the examples recursively by choosing one attribute each time. Bottom-up tree pruning Remove subtrees or branches, in a bottom-up manner, to improve the estimated accuracy on new cases Discussed next week

Choosing the splitting attribute At each node, available attributes are evaluated on the basis of separating the classes of the training examples A goodness function is used for this purpose Typical goodness functions: information gain (ID3/C4.5) information gain ratio gini index (not discussed)

A criterion for attribute selection Which is the best attribute? The one which will result in the smallest tree Heuristic: choose the attribute that produces the purest nodes Pure and high entropy are opposites Popular impurity criterion: information gain Information gain uses entropy H(p) of the class attribute Information gain increases with the average purity of the subsets that an attribute produces Strategy: choose attribute that results in greatest information gain

Which attribute to select? Outlook has one pure branch, but the other branches still have considerable entropy (uncertainty). The other three splits seem suboptimal, but detailed computation needs to determine this.

Consider entropy H(p) done allmost 1 bit of information required pure, 100% yes not pure at all, 40% yes not pure at all, 40% yes pure, 100% yes done allmost 1 bit of information required to distinguish yes and no

Entropy H(0) = 0 pure node, distribution is skewed Entropy: H(p) = – plg(p) – (1–p)lg(1–p) H(0) = 0 pure node, distribution is skewed H(1) = 0 pure node, distribution is skewed H(0.5) = 1 mixed node, equal distribution

Information gain Information before split minus information after split gain(A) = H(p) – ΣH(pi)ni/n p probability of positive in current set n number of examples in current set pi probability of positive in branch i ni number of examples in branch i i before split after split

Example: attribute “Outlook” Outlook = “Sunny”: H([2,3]) = H(0.4) = −0.4lg(0.4)−0.6lg(0.6) = 0.971 bit Outlook = “Overcast”: H([4,0]) = H(1) = −1lg(1)−0lg(0) = 0 bit Outlook = “Rainy”: H([3,2]) = H(0.6) = −0.6lg(0.6)−0.4lg(0.4)= 0.971 bit Average entropy for Outlook: Weighted sum: (5/14)0.971 + (4/14)0 + (5/14)0.971 = 0.693 0lg(0) is not defined, but we evaluate 0lg(0) as zero

Computing the information gain Information gain for Outlook gain(Outlook) = H([9,5]) – 0.693 = 0.94 – 0.693 = 0.247 bit Information gain for attributes from weather data: gain(Outlook) = 0.247 bit gain(Temperature) = 0.029 bit gain(Humidity) = 0.152 bit gain(Windy) = 0.048 bit

Continuing to split

The final decision tree Note: not all leaves need to be pure; sometimes identical examples have different classes  Splitting stops when data can’t be split any further

Highly-branching attributes Problematic: attributes with a large number of values (extreme case: customer ID) Subsets are more likely to be pure if there is a large number of values Information gain is biased towards choosing attributes with a large number of values This may result in overfitting (selection of an attribute that is non-optimal for prediction)

Weather data with ID ID Outlook Temperature Humidity Windy Play? A sunny hot high false No B true C overcast Yes D rain mild E cool normal F G H I J K L M N

Split for ID attribute Entropy of each branch = 0 (since each leaf node is pure, having only one case) Information gain is maximal for ID

Gain ratio Gain ratio: a modification of the information gain that reduces its bias on high-branch attributes Gain ratio should be Large when data is divided in few, even groups Small when each example belongs to a separate branch Gain ratio takes number and size of branches into account when choosing an attribute It corrects the information gain by taking the intrinsic information of a split into account (i.e. how much info do we need to tell which branch an instance belongs to)

Gain ratio and intrinsic information Intrinsic information: entropy of distribution of instances into branches Gain ratio normalizes info gain by:

Computing the gain ratio Example: intrinsic information for ID Importance of attribute decreases as intrinsic information gets larger Example:

Gain ratios for weather data Outlook Temperature Entropy: 0.693 0.911 Gain: 0.940-0.693 0.247 Gain: 0.940-0.911 0.029 Split info: H([5,4,5]) 1.577 Split info: H([4,6,4]) 1.362 Gain ratio: 0.247/1.577 0.156 Gain ratio: 0.029/1.362 0.021 Humidity Windy Entropy: 0.788 0.892 Gain: 0.940-0.788 0.152 Gain: 0.940-0.892 0.048 Split info: H([7,7]) 1.000 Split info: H([8,6]) 0.985 Gain ratio: 0.152/1.000 Gain ratio: 0.048/0.985 0.049

More on the gain ratio Outlook still comes out top However: ID has greater gain ratio Standard fix: ad hoc test to prevent splitting on that type of attribute Problem with gain ratio: it may overcompensate May choose an attribute just because its intrinsic information is very low Standard fix: First, only consider attributes with greater than average information gain Then, compare them on gain ratio