Classification: Decision Trees 2 Outline  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain and Gain Ratio.

Slides:



Advertisements
Similar presentations
Lecture 3: CBR Case-Base Indexing
Advertisements

Decision Tree Learning - ID3
CHAPTER 9: Decision Trees
Machine Learning in Real World: C4.5
Decision Tree Approach in Data Mining
Classification Techniques: Decision Tree Learning
Naïve Bayes: discussion
Chapter 7 – Classification and Regression Trees
Decision Trees.
Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei Han.
1 Classification with Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Classification: Decision Trees
Induction of Decision Trees
1 Classification with Decision Trees I Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Biological Data Mining (Predicting Post-synaptic Activity in Proteins)
Algorithms for Classification: Notes by Gregory Piatetsky.
Decision Trees an Introduction.
Review. 2 Statistical modeling  “Opposite” of 1R: use all the attributes  Two assumptions: Attributes are  equally important  statistically independent.
Inferring rudimentary rules
Algorithms for Classification: The Basic Methods.
Classification.
Machine Learning Lecture 10 Decision Trees G53MLE Machine Learning Dr Guoping Qiu1.
Learning Chapter 18 and Parts of Chapter 20
ETHEM ALPAYDIN © The MIT Press, Lecture Slides for.
ID3 Algorithm Allan Neymark CS157B – Spring 2007.
Induction of Decision Trees Blaž Zupan and Ivan Bratko magix.fri.uni-lj.si/predavanja/uisp.
Fall 2004 TDIDT Learning CS478 - Machine Learning.
Machine Learning Chapter 3. Decision Tree 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 II. 2 Numeric Attributes Numeric attributes can take many values –Creating branches for each value is not ideal The value range is usually.
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.
Decision Tree Learning Debapriyo Majumdar Data Mining – Fall 2014 Indian Statistical Institute Kolkata August 25, 2014.
1 Learning Chapter 18 and Parts of Chapter 20 AI systems are complex and may have many parameters. It is impractical and often impossible to encode all.
Decision-Tree Induction & Decision-Rule Induction
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
Algorithms: Decision Trees 2 Outline  Introduction: Data Mining and Classification  Classification  Decision trees  Splitting attribute  Information.
 Classification 1. 2  Task: Given a set of pre-classified examples, build a model or classifier to classify new cases.  Supervised learning: classes.
MACHINE LEARNING 10 Decision Trees. Motivation  Parametric Estimation  Assume model for class probability or regression  Estimate parameters from all.
Algorithms for Classification: The Basic Methods.
Slide 1 DSCI 4520/5240: Data Mining Fall 2013 – Dr. Nick Evangelopoulos Lecture 5: Decision Tree Algorithms Material based on: Witten & Frank 2000, Olson.
1 Classification with Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
1 Classification: predicts categorical class labels (discrete or nominal) classifies data (constructs a model) based on the training set and the values.
Data Mining By Farzana Forhad CS 157B. Agenda Decision Tree and ID3 Rough Set Theory Clustering.
Decision Trees.
Machine Learning Recitation 8 Oct 21, 2009 Oznur Tastan.
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 Reporter: Yuen-Kuei Hsueh.
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.
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.
Decision Trees an introduction.
Algorithms for Classification:
Classification Algorithms
Artificial Intelligence
Ch9: Decision Trees 9.1 Introduction A decision tree:
Data Science Algorithms: The Basic Methods
Decision Tree Saed Sayad 9/21/2018.
Classification and Prediction
ID3 Algorithm.
Classification with Decision Trees
Data Mining(中国人民大学) Yang qiang(香港科技大学) Han jia wei(UIUC)
Junheng, Shengming, Yunsheng 10/19/2018
Data Mining CSCI 307, Spring 2019 Lecture 15
Presentation transcript:

Classification: Decision Trees

2 Outline  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain and Gain Ratio

3 DECISION TREE  An internal node is a test on an attribute.  A branch represents an outcome of the test, e.g., Color=red.  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.

4 Weather Data: Play or not Play? OutlookTemperatureHumidityWindyPlay? sunnyhothighfalseNo sunnyhothightrueNo overcasthothighfalseYes rainmildhighfalseYes raincoolnormalfalseYes raincoolnormaltrueNo overcastcoolnormaltrueYes sunnymildhighfalseNo sunnycoolnormalfalseYes rainmildnormalfalseYes sunnymildnormaltrueYes overcastmildhightrueYes overcasthotnormalfalseYes rainmildhightrueNo Note: Outlook is the Forecast, no relation to Microsoft program

5 overcast highnormal false true sunny rain No Yes Example Tree for “Play?” Outlook Humidity Windy

6 Building Decision Tree [Q93]  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.

7 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 witten&eibe

8 Which attribute to select? witten&eibe

9 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  Popular impurity criterion: information gain  Information gain increases with the average purity of the subsets that an attribute produces  Strategy: choose attribute that results in greatest information gain witten&eibe

10 Computing information  Information is measured in bits  Given a probability distribution, the info required to predict an event is the distribution’s entropy  Entropy gives the information required in bits (this can involve fractions of bits!)  Formula for computing the entropy: witten&eibe

11 Claude Shannon, who has died aged 84, perhaps more than anyone laid the groundwork for today’s digital revolution. His exposition of information theory, stating that all information could be represented mathematically as a succession of noughts and ones, facilitated the digital manipulation of data without which today’s information society would be unthinkable. Shannon’s master’s thesis, obtained in 1940 at MIT, demonstrated that problem solving could be achieved by manipulating the symbols 0 and 1 in a process that could be carried out automatically with electrical circuitry. That dissertation has been hailed as one of the most significant master’s theses of the 20th century. Eight years later, Shannon published another landmark paper, A Mathematical Theory of Communication, generally taken as his most important scientific contribution. Born: 30 April 1916 Died: 23 February 2001 “Father of information theory” Shannon applied the same radical approach to cryptography research, in which he later became a consultant to the US government. Many of Shannon’s pioneering insights were developed before they could be applied in practical form. He was truly a remarkable man, yet unknown to most of the world. witten&eibe *Claude Shannon

12 Example: attribute “Outlook”  “Outlook” = “Sunny”:  “Outlook” = “Overcast”:  “Outlook” = “Rainy”:  Expected information for attribute: Note: log(0) is not defined, but we evaluate 0*log(0) as zero witten&eibe

13 Computing the information gain  Information gain: (information before split) – (information after split)  Information gain for attributes from weather data: witten&eibe

14 Continuing to split witten&eibe

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

16 *Wish list for a purity measure  Properties we require from a purity measure:  When node is pure, measure should be zero  When impurity is maximal (i.e. all classes equally likely), measure should be maximal  Measure should obey multistage property (i.e. decisions can be made in several stages):  Entropy is a function that satisfies all three properties! witten&eibe

17 *Properties of the entropy  The multistage property:  Simplification of computation:  Note: instead of maximizing info gain we could just minimize information witten&eibe

18 Highly-branching attributes  Problematic: attributes with a large number of values (extreme case: ID code)  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) witten&eibe

19 Weather Data with ID code ID OutlookTemperatureHumidityWindyPlay? A sunnyhothighfalseNo B sunnyhothightrueNo C overcasthothighfalseYes D rainmildhighfalseYes E raincoolnormalfalseYes F raincoolnormaltrueNo G overcastcoolnormaltrueYes H sunnymildhighfalseNo I sunnycoolnormalfalseYes J rainmildnormalfalseYes K sunnymildnormaltrueYes L overcastmildhightrueYes M overcasthotnormalfalseYes N rainmildhightrueNo

20 Split for ID Code Attribute Entropy of split = 0 (since each leaf node is “pure”, having only one case. Information gain is maximal for ID code witten&eibe

21 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 evenly spread  Small when all data belong to one 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) witten&eibe

22 Gain Ratio and Intrinsic Info.  Intrinsic information: entropy of distribution of instances into branches  Gain ratio (Quinlan’86) normalizes info gain by:

23 Computing the gain ratio  Example: intrinsic information for ID code  Importance of attribute decreases as intrinsic information gets larger  Example of gain ratio:  Example: witten&eibe

24 Gain ratios for weather data OutlookTemperature Info:0.693Info:0.911 Gain: Gain: Split info: info([5,4,5])1.577Split info: info([4,6,4])1.362 Gain ratio: 0.247/ Gain ratio: 0.029/ HumidityWindy Info:0.788Info:0.892 Gain: Gain: Split info: info([7,7])1.000Split info: info([8,6])0.985 Gain ratio: 0.152/10.152Gain ratio: 0.048/ witten&eibe

25 More on the gain ratio  “Outlook” still comes out top  However: “ID code” 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 witten&eibe

26  If a data set T contains examples from n classes, gini index, gini(T) is defined as where p j is the relative frequency of class j in T. gini(T) is minimized if the classes in T are skewed. *CART Splitting Criteria: Gini Index

27 After splitting T into two subsets T1 and T2 with sizes N1 and N2, the gini index of the split data is defined as  The attribute providing smallest gini split (T) is chosen to split the node. *Gini Index

28 Discussion  Algorithm for top-down induction of decision trees (“ID3”) was developed by Ross Quinlan  Gain ratio just one modification of this basic algorithm  Led to development of C4.5, which can deal with numeric attributes, missing values, and noisy data  Similar approach: CART (to be covered later)  There are many other attribute selection criteria! (But almost no difference in accuracy of result.)

29 Summary  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain biased towards attributes with a large number of values  Gain Ratio takes number and size of branches into account when choosing an attribute