Chapter 6 Decision Tree.

Slides:



Advertisements
Similar presentations
Classification and Prediction
Advertisements

Data Mining Lecture 9.
Paper By - Manish Mehta, Rakesh Agarwal and Jorma Rissanen
Huffman code and ID3 Prof. Sin-Min Lee Department of Computer Science.
Data Mining Techniques: Classification. Classification What is Classification? –Classifying tuples in a database –In training set E each tuple consists.
IT 433 Data Warehousing and Data Mining
Decision Tree Approach in Data Mining
Classification Techniques: Decision Tree Learning
Decision Trees Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei Han.
Lecture outline Classification Decision-tree classification.
Classification and Prediction
Basic Data Mining Techniques Chapter Decision Trees.
1 Classification with Decision Trees I Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.
Basic Data Mining Techniques
Classification Continued
Classification II.
Classification Based in part on Chapter 10 of Hand, Manilla, & Smyth and Chapter 7 of Han and Kamber David Madigan.
Data Mining: A Closer Look Chapter Data Mining Strategies (p35) Moh!
Classification and Prediction
Classification.
Chapter 7 Decision Tree.
Basic Data Mining Techniques
DATA MINING : CLASSIFICATION. Classification : Definition  Classification is a supervised learning.  Uses training sets which has correct answers (class.
Inductive learning Simplest form: learn a function from examples
Mohammad Ali Keyvanrad
Basics of Decision Trees  A flow-chart-like hierarchical tree structure –Often restricted to a binary structure  Root: represents the entire dataset.
Basic Data Mining Technique
Decision Trees. 2 Outline  What is a decision tree ?  How to construct a decision tree ? What are the major steps in decision tree induction ? How to.
CS685 : Special Topics in Data Mining, UKY The UNIVERSITY of KENTUCKY Classification CS 685: Special Topics in Data Mining Fall 2010 Jinze Liu.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Classification COMP Seminar BCB 713 Module Spring 2011.
CS690L Data Mining: Classification
For Monday No new reading Homework: –Chapter 18, exercises 3 and 4.
Chapter 6 Classification and Prediction Dr. Bernard Chen Ph.D. University of Central Arkansas.
1 Universidad de Buenos Aires Maestría en Data Mining y Knowledge Discovery Aprendizaje Automático 5-Inducción de árboles de decisión (2/2) Eduardo Poggi.
Decision Trees Binary output – easily extendible to multiple output classes. Takes a set of attributes for a given situation or object and outputs a yes/no.
Machine Learning Decision Trees. E. Keogh, UC Riverside Decision Tree Classifier Ross Quinlan Antenna Length Abdomen Length.
Classification and Prediction
1 Classification: predicts categorical class labels (discrete or nominal) classifies data (constructs a model) based on the training set and the values.
Decision Trees.
Outline Decision tree representation ID3 learning algorithm Entropy, Information gain Issues in decision tree learning 2.
Basic Data Mining Techniques Chapter 3-A. 3.1 Decision Trees.
Dr. Chen, Data Mining  A/W & Dr. Chen, Data Mining Chapter 3 Basic Data Mining Techniques Jason C. H. Chen, Ph.D. Professor of MIS School of Business.
DATA MINING TECHNIQUES (DECISION TREES ) Presented by: Shweta Ghate MIT College OF Engineering.
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.
DECISION TREES An internal node represents a test on an attribute.
Decision Trees an introduction.
Artificial Intelligence
Chapter 6 Classification and Prediction
Data Science Algorithms: The Basic Methods
Information Management course
Decision Tree Saed Sayad 9/21/2018.
Introduction to Data Mining, 2nd Edition by
Classification and Prediction
Introduction to Data Mining, 2nd Edition by
Classification and Prediction — Slides for Textbook — — Chapter 7 —
CS 685: Special Topics in Data Mining Jinze Liu
Data Mining – Chapter 3 Classification
Classification with Decision Trees
CS 685: Special Topics in Data Mining Jinze Liu
CSCI N317 Computation for Scientific Applications Unit Weka
Classification and Prediction
©Jiawei Han and Micheline Kamber
Avoid Overfitting in Classification
Classification.
CS 685: Special Topics in Data Mining Spring 2009 Jinze Liu
CS 685: Special Topics in Data Mining Jinze Liu
Classification 1.
Presentation transcript:

Chapter 6 Decision Tree

Decision Trees An Algorithm for Building Decision Trees 1. Let T be the set of training instances. 2. Choose an attribute that best differentiates the instances contained in T. 3. Create a tree node whose value is the chosen attribute. Create child links from this node where each link represents a unique value for the chosen attribute. Use the child link values to further subdivide the instances into subclasses. Chapter 6

Decision Trees An Algorithm for Building Decision Trees 4. For each subclass created in step 3: a. If the instances in the subclass satisfy predefined criteria or if the set of remaining attribute choices for this path of the tree is null, specify the classification for new instances following this decision path. b. If the subclass does not satisfy the predefined criteria and there is at least one attribute to further subdivide the path of the tree, let T be the current set of subclass instances and return to step 2. Chapter 6

Decision Trees An Algorithm for Building Decision Trees Chapter 6

Decision Trees An Algorithm for Building Decision Trees Chapter 6

Decision Trees An Algorithm for Building Decision Trees Chapter 6

Decision Trees An Algorithm for Building Decision Trees Chapter 6

Decision Trees Decision Trees for the Credit Card Promotion Database Chapter 6

Decision Trees Decision Trees for the Credit Card Promotion Database Chapter 6

Decision Trees Decision Trees for the Credit Card Promotion Database Chapter 6

Decision Trees Decision Tree Rules IF Age <= 43 & Sex = Male & Credit Card Insurance = No THEN Life Insurance Promotion = No IF Sex = Male & Credit Card Insurance = No THEN Life Insurance Promotion = No Chapter 6

Decision Trees General Considerations Here is a list of a few of the many advantages decision trees have to offer. Decision trees are easy to understand and map nicely to a set of production rules. Decision trees have been successfully applied to real problems. Decision trees make no prior assumptions about the nature of the data. Decision trees are able to build models with datasets containing numerical as well as categorical data. Chapter 6

Decision Trees General Considerations As with all data mining algorithms, there are several issues surrounding decision tree usage. Specifically, Output attributes must be categorical, and multiple output attributes are not allowed. Decision tree algorithms are unstable in that slight variations in the training data can result in different attribute selections at each choice point with in the tree. The effect can be significant as attribute choices affect all descendent subtrees. Trees created from numeric datasets can be quite complex as attribute splits for numeric data are typically binary. Chapter 6

Classification by Decision Tree Induction A flow-chart-like tree structure Internal node denotes a test on an attribute Branch represents an outcome of the test Leaf nodes represent class labels or class distribution Decision tree generation consists of two phases Tree construction At start, all the training examples are at the root Partition examples recursively based on selected attributes Tree pruning Identify and remove branches that reflect noise or outliers Use of decision tree: Classifying an unknown sample Test the attribute values of the sample against the decision tree Chapter 6

Training Dataset This follows an example from Quinlan’s ID3 Chapter 6

Output: A Decision Tree for “buys_computer” age? overcast student? credit rating? no yes fair excellent <=30 >40 30..40 Chapter 6

Algorithm for Decision Tree Induction Basic algorithm (a greedy algorithm) Tree is constructed in a top-down recursive divide-and-conquer manner At start, all the training examples are at the root Attributes are categorical (if continuous-valued, they are discretized in advance) Examples are partitioned recursively based on selected attributes Test attributes are selected on the basis of a heuristic or statistical measure (e.g., information gain) Conditions for stopping partitioning All samples for a given node belong to the same class There are no remaining attributes for further partitioning – majority voting is employed for classifying the leaf There are no samples left Chapter 6

weather sunny cloudy rainy Temp > 75 BBQ Eat in Eat in windy BBQ yes no Chapter 6

Attribute Selection Measure Information gain (ID3/C4.5) All attributes are assumed to be categorical Can be modified for continuous-valued attributes Gini index (IBM IntelligentMiner) All attributes are assumed continuous-valued Assume there exist several possible split values for each attribute May need other tools, such as clustering, to get the possible split values Can be modified for categorical attributes Chapter 6

Information Gain (ID3/C4.5) Select the attribute with the highest information gain Assume there are two classes, ....P and ....N Let the set of examples S contain ...p elements of class P ...n elements of class N The amount of information, needed to decide if an arbitrary example in S belongs to P or N is defined as Chapter 6

Information Gain in Decision Tree Induction Assume that using attribute A a set S will be partitioned into sets {S1, S2 , …, Sv} If Si contains pi examples of P and ni examples of N ,the entropy, or the expected information needed to classify objects in all subtrees Si is The encoding information that would be gained by branching on A Chapter 6

Attribute Selection by Information Gain Computation Chapter 6

Attribute Selection by Information Gain Computation -9/(9+5)log2 9/(9+5) – 5/(9+5)log25/(9+5) Class P: buys_computer = “yes” Class N: buys_computer = “no” I(p, n) = I(9, 5) = 0.940 Compute the entropy for age: 9 5 Chapter 6

Attribute Selection by Information Gain Computation Similarly I(p, n) = I(9, 5) =0.940 Gain(age) = 0.940 –0.692 = 0.248 Chapter 6

Extracting Classification Rules from Trees Represent the knowledge in the form of IF-THEN rules One rule is created for each path from the root to a leaf Each attribute-value pair along a path forms a conjunction The leaf node holds the class prediction Rules are easier for humans to understand Chapter 6

Output: A Decision Tree for “buys_computer” IF age = “<=30” AND student = “no” THEN buys_computer = “no” IF age = “<=30” AND student = “yes” THEN buys_computer = “yes” IF age = “31…40” THEN buys_computer = “yes” IF age = “>40” AND credit_rating = “excellent” THEN buys_computer = “yes” IF age = “<=30” AND credit_rating = “fair” THEN buys_computer = “no” age? overcast student? credit rating? no yes fair excellent <=30 >40 30..40 Chapter 6 Output: A Decision Tree for “buys_computer”

Avoid Overfitting in Classification The generated tree may overfit the training data Too many branches...., some may reflect anomalies due to noise or outliers Result is in poor accuracy for unseen samples Two approaches to avoid overfitting Prepruning: Halt tree construction early—do not split a node if this would result in the goodness measure falling below a threshold Difficult to choose an appropriate threshold Postpruning: Remove branches from a “fully grown” tree—get a sequence of progressively pruned trees Use a set of data different from the training data to decide which is the “best pruned tree” Chapter 6

Approaches to Determine the Final Tree Size Separate training (2/3) and testing (1/3) sets Use cross validation, e.g., 10-fold cross validation Use all the data for training but apply a statistical test (e.g., chi-square) to estimate whether expanding or pruning a node may improve the entire distribution Use minimum description length (MDL) principle: halting growth of the tree when the encoding is minimized Chapter 6

Enhancements to basic decision tree induction Allow for continuous-valued attributes Dynamically define new discrete-valued attributes that partition the continuous attribute value into a discrete set of intervals Handle missing attribute values Assign the most common value of the attribute Assign probability to each of the possible values Attribute construction Create new attributes based on existing ones that are sparsely represented This reduces fragmentation, repetition, and replication Chapter 6

Classification in Large Databases Classification—a classical problem extensively studied by statisticians and machine learning researchers Scalability: Classifying data sets with millions of examples and hundreds of attributes with reasonable speed Why decision tree induction in data mining? relatively faster learning speed (than other classification methods) convertible to simple and easy to understand classification rules can use SQL queries for accessing databases comparable classification accuracy with other methods Chapter 6

Chapter Summary Decision trees are probably the most popular structure for supervised data mining. A common algorithm for building a decision tree selects a subset of instances from the training data to construct an initial tree. The remaining training instances are then used to test the accuracy of the tree. If any instance is incorrectly classified the instance is added to the current set of training data and the process is repeated. Chapter 6

Chapter Summary A main goal is to minimize the number of tree levels and tree nodes, thereby maximizing data generalization. Decision trees have been successfully applied to real problems, are easy to understand, and map nicely to a set of production rules. Chapter 6

Reference Data Mining: Concepts and Techniques (Chapter 7 Slide for textbook), Jiawei Han and Micheline Kamber, Intelligent Database Systems Research Lab, School of Computing Science, Simon Fraser University, Canada Chapter 6