1 Classification with Decision Trees I Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei.

Slides:



Advertisements
Similar presentations
COMP3740 CR32: Knowledge Management and Adaptive Systems
Advertisements

Decision Trees Decision tree representation ID3 learning algorithm
CPSC 502, Lecture 15Slide 1 Introduction to Artificial Intelligence (AI) Computer Science cpsc502, Lecture 15 Nov, 1, 2011 Slide credit: C. Conati, S.
Classification Algorithms
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.
Decision Tree Approach in Data Mining
Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation Lecture Notes for Chapter 4 Part I Introduction to Data Mining by Tan,
Decision Tree.
Classification Techniques: Decision Tree Learning
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.
Classification and Prediction
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
Induction of Decision Trees
Decision Trees an Introduction.
Inferring rudimentary rules
Classification.
Classification: Decision Trees 2 Outline  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain and Gain Ratio.
Chapter 7 Decision Tree.
Data Mining: Classification
Machine Learning Chapter 3. Decision Tree Learning
Chapter 9 – Classification and Regression Trees
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 Trees Jyh-Shing Roger Jang ( 張智星 ) CSIE Dept, National Taiwan University.
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.
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.
Data Mining – Algorithms: Decision Trees - ID3 Chapter 4, Section 4.3.
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.
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.
Classification and Prediction
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.
Decision Trees.
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 TECHNIQUES (DECISION TREES ) Presented by: Shweta Ghate MIT College OF Engineering.
Decision Tree Learning DA514 - Lecture Slides 2 Modified and expanded from: E. Alpaydin-ML (chapter 9) T. Mitchell-ML.
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.
Chapter 6 Decision Tree.
DECISION TREES An internal node represents a test on an attribute.
Decision Trees an introduction.
Classification Algorithms
Prepared by: Mahmoud Rafeek Al-Farra
Artificial Intelligence
Ch9: Decision Trees 9.1 Introduction A decision tree:
Chapter 6 Classification and Prediction
Data Science Algorithms: The Basic Methods
Decision Tree Saed Sayad 9/21/2018.
Introduction to Data Mining, 2nd Edition by
Classification and Prediction
Data Mining – Chapter 3 Classification
Classification with Decision Trees
CSCI N317 Computation for Scientific Applications Unit Weka
Data Mining(中国人民大学) Yang qiang(香港科技大学) Han jia wei(UIUC)
Junheng, Shengming, Yunsheng 10/19/2018
©Jiawei Han and Micheline Kamber
Data Mining CSCI 307, Spring 2019 Lecture 15
Classification 1.
Presentation transcript:

1 Classification with Decision Trees I Instructor: Qiang Yang Hong Kong University of Science and Technology Thanks: Eibe Frank and Jiawei Han

Given a set of pre-classified examples, build a model or classifier to classify new cases. Supervised learning in that classes are known for the examples used to build the classifier. A classifier can be a set of rules, a decision tree, a neural network, etc. Typical Applications: credit approval, target marketing, fraud detection, medical diagnosis, treatment effectiveness analysis, ….. INTRODUCTION

3 Constructing a Classifier The goal is to maximize the accuracy on new cases that have similar class distribution. Since new cases are not available at the time of construction, the given examples are divided into the testing set and the training set. The classifier is built using the training set and is evaluated using the testing set. The goal is to be accurate on the testing set. It is essential to capture the “structure” shared by both sets. Must prune overfitting rules that work well on the training set, but poorly on the testing set.

Example Training Data Classification Algorithms IF rank = ‘professor’ OR years > 6 THEN tenured = ‘yes’ Classifier (Model)

Example (Conted) Classifier Testing Data Unseen Data (Jeff, Professor, 4) Tenured?

Evaluation Criteria Accuracy on test set the rate of correct classification on the testing set. E.g., if 90 are classified correctly out of the 100 testing cases, accuracy is 90%. Error Rate on test set The percentage of wrong predictions on test set Confusion Matrix For binary class values, “yes” and “no”, a matrix showing true positive, true negative, false positive and false negative rates Speed and scalability the time to build the classifier and to classify new cases, and the scalability with respect to the data size. Robustness: handling noise and missing values Predicted class YesNo Actual class YesTrue positive False negativ e NoFalse positive True negativ e

Evaluation Techniques Holdout: the training set/testing set. Good for a large set of data. k-fold Cross-validation: divide the data set into k sub-samples. In each run, use one distinct sub-sample as testing set and the remaining k-1 sub-samples as training set. Evaluate the method using the average of the k runs. This method reduces the randomness of training set/testing set.

8 8 Cross Validation: Holdout Method — Break up data into groups of the same size — — Hold aside one group for testing and use the rest to build model — — Repeat Test iteration

9 Continuous Classes Sometimes, classes are continuous in that they come from a continuous domain, e.g., temperature or stock price. Regression is well suited in this case: Linear and multiple regression Non-Linear regression We shall focus on categorical classes, e.g., colors or Yes/No binary decisions. We will deal with continuous class values later in CART

10 DECISION TREE [Quinlan93] An internal node represents 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.

Training Set

Outlook overcast humiditywindy highnormal false true sunny rain NNPP P overcast Example

13 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.

14 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

15 Which attribute to select?

16 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

17 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:

18 Example: attribute “Outlook” “Outlook” = “Sunny”: “Outlook” = “Overcast”: “Outlook” = “Rainy”: Expected information for attribute: Note: this is normally not defined.

19 Computing the information gain Information gain: information before splitting – information after splitting Information gain for attributes from weather data:

20 Continuing to split

21 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

22 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) Another problem: fragmentation

23 The gain ratio Gain ratio: a modification of the information gain that reduces its bias on high-branch attributes 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 Also called split ratio Intrinsic information: entropy of distribution of instances into branches (i.e. how much info do we need to tell which branch an instance belongs to)

Gain Ratio Gain ratio should be Large when data is evenly spread Small when all data belong to one branch Gain ratio (Quinlan’86) normalizes info gain by this reduction:

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

26 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/

27 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

Gini Index If a data set T contains examples from n classes, gini index, gini(T) is defined as where pj is the relative frequency of class j in T. gini(T) is minimized if the classes in T are skewed. 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 ginisplit(T) is chosen to split the node.

29 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 (linear regression tree, WF book, Chapter 6.5) There are many other attribute selection criteria! (But almost no difference in accuracy of result.)