Classification Part 2. Overview

Similar documents
Data Mining Classification: Alternative Techniques. Lecture Notes for Chapter 5. Introduction to Data Mining

Lecture Notes for Chapter 5 (PART 1)

Advanced classifica-on methods

Lecture Notes for Chapter 5. Introduction to Data Mining

Classification Lecture 2: Methods

Machine Learning 2nd Edition

Probabilistic Methods in Bioinformatics. Pabitra Mitra

7 Classification: Naïve Bayes Classifier

Statistics 202: Data Mining. c Jonathan Taylor. Week 6 Based in part on slides from textbook, slides of Susan Holmes. October 29, / 1

DATA MINING LECTURE 10

Data Analysis. Santiago González

DATA MINING: NAÏVE BAYES

Lecture VII: Classification I. Dr. Ouiem Bchir

Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation

Given a collection of records (training set )

Inductive Learning. Chapter 18. Material adopted from Yun Peng, Chuck Dyer, Gregory Piatetsky-Shapiro & Gary Parker

Data Mining vs Statistics

Data Mining Condensed Draft of a Lecture starting in Summer Term 2010 as developed up to November 2009

Decision Tree Learning

Einführung in Web- und Data-Science

the tree till a class assignment is reached

CS6375: Machine Learning Gautam Kunapuli. Decision Trees

Classification: Rule Induction Information Retrieval and Data Mining. Prof. Matteo Matteucci

Data Mining and Machine Learning (Machine Learning: Symbolische Ansätze)

Introduction to Machine Learning CMU-10701

Data Mining Classification: Basic Concepts and Techniques. Lecture Notes for Chapter 3. Introduction to Data Mining, 2nd Edition

Lecture 3: Decision Trees

Oliver Dürr. Statistisches Data Mining (StDM) Woche 11. Institut für Datenanalyse und Prozessdesign Zürcher Hochschule für Angewandte Wissenschaften

Part I. Linear regression & LASSO. Linear Regression. Linear Regression. Week 10 Based in part on slides from textbook, slides of Susan Holmes

Question of the Day. Machine Learning 2D1431. Decision Tree for PlayTennis. Outline. Lecture 4: Decision Tree Learning

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

CHAPTER-17. Decision Tree Induction

Classification and Prediction

Mining Classification Knowledge

Data Mining vs Statistics

Decision Tree Learning

Lecture 3: Decision Trees

Notes on Machine Learning for and

CS145: INTRODUCTION TO DATA MINING

ML techniques. symbolic techniques different types of representation value attribute representation representation of the first order

Holdout and Cross-Validation Methods Overfitting Avoidance

Geometric View of Machine Learning Nearest Neighbor Classification. Slides adapted from Prof. Carpuat

Introduction to Machine Learning

CMSC 422 Introduction to Machine Learning Lecture 4 Geometry and Nearest Neighbors. Furong Huang /

Learning From Inconsistent and Noisy Data: The AQ18 Approach *

Data preprocessing. DataBase and Data Mining Group 1. Data set types. Tabular Data. Document Data. Transaction Data. Ordered Data

Induction of Decision Trees

Data Mining and Machine Learning

CLUe Training An Introduction to Machine Learning in R with an example from handwritten digit recognition

Overview. Machine Learning, Chapter 2: Concept Learning

Introduction. Decision Tree Learning. Outline. Decision Tree 9/7/2017. Decision Tree Definition

Data Mining algorithms

University of Florida CISE department Gator Engineering. Clustering Part 1

Decision Trees: Overfitting

Decision trees. Special Course in Computer and Information Science II. Adam Gyenge Helsinki University of Technology

Data Mining Prof. Pabitra Mitra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Decision Tree Learning

EECS 349:Machine Learning Bryan Pardo

Data Mining. Preamble: Control Application. Industrial Researcher s Approach. Practitioner s Approach. Example. Example. Goal: Maintain T ~Td

Supervised Learning! Algorithm Implementations! Inferring Rudimentary Rules and Decision Trees!

Data classification (II)

[read Chapter 2] [suggested exercises 2.2, 2.3, 2.4, 2.6] General-to-specific ordering over hypotheses

Decision T ree Tree Algorithm Week 4 1

M chi h n i e n L e L arni n n i g Decision Trees Mac a h c i h n i e n e L e L a e r a ni n ng

Principles of Pattern Recognition. C. A. Murthy Machine Intelligence Unit Indian Statistical Institute Kolkata

Science Notes. P3 Diversity. Living Things

CS 6375 Machine Learning

Introduction to ML. Two examples of Learners: Naïve Bayesian Classifiers Decision Trees

Decision Tree Learning and Inductive Inference

Classification Based on Logical Concept Analysis

Machine Learning & Data Mining

Outline. Training Examples for EnjoySport. 2 lecture slides for textbook Machine Learning, c Tom M. Mitchell, McGraw Hill, 1997

Decision Trees Entropy, Information Gain, Gain Ratio

Text Mining. Dr. Yanjun Li. Associate Professor. Department of Computer and Information Sciences Fordham University

Data Mining: Data. Lecture Notes for Chapter 2. Introduction to Data Mining

Decision Trees. Tirgul 5

Lecture 7 Decision Tree Classifier

Decision Tree Analysis for Classification Problems. Entscheidungsunterstützungssysteme SS 18

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Data Mining. 3.6 Regression Analysis. Fall Instructor: Dr. Masoud Yaghini. Numeric Prediction

Chapter 7: Diversity in Living Organisms Science

Data Mining: Data. Lecture Notes for Chapter 2. Introduction to Data Mining

Lazy Rule Learning Nikolaus Korfhage

MIDTERM: CS 6375 INSTRUCTOR: VIBHAV GOGATE October,

CS6220: DATA MINING TECHNIQUES

Lecture 4: Data preprocessing: Data Reduction-Discretization. Dr. Edgar Acuna. University of Puerto Rico- Mayaguez math.uprm.

Concept Learning. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University.

Mining Classification Knowledge

Introduction to machine learning. Concept learning. Design of a learning system. Designing a learning system

Data Mining. Dimensionality reduction. Hamid Beigy. Sharif University of Technology. Fall 1395

Concept Learning Mitchell, Chapter 2. CptS 570 Machine Learning School of EECS Washington State University

Learning Classification Trees. Sargur Srihari

Classification. Classification. What is classification. Simple methods for classification. Classification by decision tree induction

Universität Potsdam Institut für Informatik Lehrstuhl Maschinelles Lernen. Intelligent Data Analysis. Decision Trees

CSCI 5622 Machine Learning

Knowledge Discovery and Data Mining

Decision Trees.

Concept Learning.

Slides for Data Mining by I. H. Witten and E. Frank

Lecture 7: DecisionTrees

Transcription:

Classification Part 2 Dr. Sanjay Ranka Professor Computer and Information Science and Engineering University of Florida, Gainesville Overview Rule based Classifiers Nearest-neighbor Classifiers Data Mining Sanjay Ranka Fall 2003 2 1

Rule Based Classifiers Classify instances by using a collection of if then rules Rules are presented in Disjunctive Normal Form, R = (r 1 v r 2 v r k ) R is called rule set r i s are called classification rules Each classification rule is of form r i : (Condition i ) y Condition is a conjunction of attribute tests y is the class label Data Mining Sanjay Ranka Fall 2003 3 Rule Based Classifiers r i : (Condition i ) y LHS of the rule is called rule antecedent or pre-condition RHS is called the rule consequent If the attributes of an instance satisfy the precondition of a rule, then the instance is assigned to the class designated by the rule consequent Example (Blood Type=Warm) (Lay Eggs=Yes) Birds (Taxable Income < 50K) (Refund=Yes) Cheat=No Data Mining Sanjay Ranka Fall 2003 4 2

Classifying Instances with Rules A rule r covers an instance x if the attributes of the instance satisfy the condition of the rule Rule: r : (Age < 35) (Status = Married) Cheat=No Instances: x 1 : (Age=29, Status=Married, Refund=No) x 2 : (Age=28, Status=Single, Refund=Yes) x 3 : (Age=38, Status=Divorced, Refund=No) Only x 1 is covered by the rule r Data Mining Sanjay Ranka Fall 2003 5 Rule Based Classifiers Rules may not be mutually exclusive More than one rule may cover the same instance Strategies: Strict enforcement of mutual exclusiveness Avoid generating rules that have overlapping coverage with previously selected rules Ordered rules Rules are rank ordered according to their priority Voting Allow an instance to trigger multiple rules, and consider the consequent of each triggered rule as a vote for that particular class Data Mining Sanjay Ranka Fall 2003 6 3

1 0 Rule Based Classifiers Rules may not be exhaustive Strategy: A default rule r d : ( ) y d can be added The default rule has an empty antecedent and is applicable when all other rules have failed y d is known as default class and is often assigned to the majority class Data Mining Sanjay Ranka Fall 2003 7 Example of Rule Based Classifier categorical Tid Refund Marital Status categorical Taxable Income continuous 1 Yes Single 125K No 2 No Married 100K No 3 No Single 70K No 4 Yes Married 120K No Evade 5 No Divorced 95K Yes 6 No Married 60K No 7 Yes Divorced 220K No 8 No Single 85K Yes 9 No Married 75K No 10 No Single 90K Yes class r 1 : (Refund=No) & (Marital Status=Single) & (Taxable Income>80K) Yes r 2 : (Refund=No) & (Marital Status=Divorced) & (Taxable Income>80K) Yes default: ( ) No Data Mining Sanjay Ranka Fall 2003 8 4

10 Advantages of Rule Based Classifiers As highly expressive as decision trees Easy to interpret Easy to generate Can classify new instances rapidly Performance comparable to decision trees Data Mining Sanjay Ranka Fall 2003 9 Coverage of a rule: Fraction of instances that satisfy the antecedent of a rule Accuracy of a rule: Basic Definitions Fraction of instances that satisfy both the antecedent and consequent of a rule Tid Refund Marital Status Taxable Income 1 Yes Single 125K No 2 No Married 100K No 3 No Single 70K No 4 Yes Married 120K No Cheat 5 No Divorced 95K Yes 6 No Married 60K No 7 Yes Divorced 220K No 8 No Single 85K Yes 9 No Married 75K No 10 No Single 90K Yes (Marital Status=Married) No Coverage = 40%, Accuracy = 100% Data Mining Sanjay Ranka Fall 2003 10 5

How to Build a Rule Based Classifier Generate an initial set of rules Direct Method: Extract rules directly from data Examples: RIPPER, CN2, Holte s 1R Indirect Method: Extract rules from other classification methods (e.g. decision trees) Example: C4.5 rules Rules are pruned and simplified Rules can be order to obtain a rule set R Rule set R can be further optimized Data Mining Sanjay Ranka Fall 2003 11 Indirect Method: From Decision Trees to Rules Yes Refund No Classification Rules NO {Single, Divorced} Marital Status {Married} (Refund=Yes) ==> No (Refund=No, Marital Status={Single,Divorced}, Taxable Income<80K) ==> No < 80K > 80K NO Taxable Income YES NO (Refund=No, Marital Status={Single,Divorced}, Taxable Income>80K) ==> Yes (Refund=No, Marital Status={Married}) ==> No Rules are mutually exclusive and exhaustive Rule set contains as much information as the tree Data Mining Sanjay Ranka Fall 2003 12 6

10 Rules can be Simplified Yes NO NO Refund {Single, Divorced} Taxable Income No Marital Status < 80K > 80K YES {Married} NO Tid Refund Marital Status Taxable Income 1 Yes Single 125K No 2 No Married 100K No 3 No Single 70K No 4 Yes Married 120K No Cheat 5 No Divorced 95K Yes 6 No Married 60K No 7 Yes Divorced 220K No 8 No Single 85K Yes 9 No Married 75K No 10 No Single 90K Yes Initial Rule: (Refund=No) (Status=Married) No Simplified Rule: (Status=Married) No Data Mining Sanjay Ranka Fall 2003 13 Indirect Method: C4.5 rules Creating an initial set of rules Extract rules from an un-pruned decision tree For each rule, r: A y Consider an alternative rule r : A y, where A is obtained by removing one of the conjuncts in A Compare the pessimistic error rate for r against all r s Prune if one of the r s has a lower pessimistic error rate Repeat until we can no longer improve the generalization error Data Mining Sanjay Ranka Fall 2003 14 7

Indirect Method: C4.5 rules Ordering the rules Instead of ordering the rules, order subsets of rules Each subset is a collection of rules with the same consequent (class) Description length of each subset is computed, and the subsets are then ordered in the increasing order of the description length Description length = L(exceptions) + g L(model) g is a parameter that takes in to account the presence of redundant attributes in a rule set. Default value is 0.5 Data Mining Sanjay Ranka Fall 2003 15 Direct Method: Sequential Covering Sequential Covering Algorithm (E: training examples, A: set of attributes) 1. Let R = { } be the initial rule set 2. While stopping criteria is not met 1. r Learn-One-Rule (E, A) 2. Remove instances from E that are covered by r 3. Add r to rule set: R = R v r Example of stopping criteria: Stop when all instances belong to same class or all attributes have same value Data Mining Sanjay Ranka Fall 2003 16 8

Example of Sequential Covering (i) Original Data (ii) Step 1 Data Mining Sanjay Ranka Fall 2003 17 Example of Sequential Covering R1 R1 R2 (iii) Step 2 (iv) Step 3 Data Mining Sanjay Ranka Fall 2003 18 9

Learn One Rule The objective of this function is to extract the best rule that covers the current set of training instances What is the strategy used for rule growing What is the evaluation criteria used for rule growing What is the stopping criteria for rule growing What is the pruning criteria for generalizing the rule Data Mining Sanjay Ranka Fall 2003 19 Learn One Rule Rule Growing Strategy General-to-specific approach It is initially assumed that the best rule is the empty rule, r: { } y, where y is the majority class of the instances Iteratively add new conjuncts to the LHS of the rule until the stopping criterion is met Specific-to-general approach A positive instance is chosen as the initial seed for a rule The function keeps refining this rule by generalizing the conjuncts until the stopping criterion is met Data Mining Sanjay Ranka Fall 2003 20 10

Learn One Rule Rule Evaluation and Stopping Criteria Evaluate rules using rule evaluation metric Accuracy Coverage Entropy Laplace M-estimate A typical condition for terminating the rule growing process is to compare the evaluation metric of the previous candidate rule to the newly grown rule Data Mining Sanjay Ranka Fall 2003 21 Learn One Rule Rule Pruning Each extracted rule can be pruned to improve their ability to generalize beyond the training instances Pruning can be done by removing one of the conjuncts of the rule and then testing it against a validation set Instance Elimination Instance elimination prevents the same rule from being generated again Positive instances must be removed after each rule is extracted Some rule based classifiers keep negative instances, while some remove them prior to generating next rule Data Mining Sanjay Ranka Fall 2003 22 11

Direct Method: Sequential Covering Use a general-to-specific search strategy Greedy approach Unlike decision tree (which uses simultaneous covering), it does not explore all possible paths Search only the current best path Beam search: maintain k of the best paths At each step, Decision tree chooses among several alternative attributes for splitting Sequential covering chooses among alternative attribute-value pairs Data Mining Sanjay Ranka Fall 2003 23 Direct Method: RIPPER For 2-class problem, choose one of the classes as positive class, and the other as negative class Learn rules for positive class Negative class will be default class For multi-class problem Order the classes according to increasing class prevalence (fraction of instances that belong to a particular class) Learn the rule set for smallest class first, treat the rest as negative class Repeat with next smallest class as positive class Data Mining Sanjay Ranka Fall 2003 24 12

Foil's Information Gain Compares the performance of a rule before and after adding a new conjunct Suppose the rule r: A y covers p 0 positive and n 0 negative instances After adding a new conjunct B, the rule r : A^B y covers p 1 positive and n 1 negative instances Foil's information gain is defined as = t [ log 2 (p 1 / (p 1 + n 1 )) - log 2 (p 0 / (p 0 + n 0 )) ] where t is the number of positive instances covered by both r and r Data Mining Sanjay Ranka Fall 2003 25 Direct Method: RIPPER Growing a rule: Start from empty rule Add conjuncts as long as they improve Foil's information gain Stop when rule no longer covers negative examples Prune the rule immediately using incremental reduced error pruning Measure for pruning: v = (p - n) / (p + n) p: number of positive examples covered by the rule in the validation set n: number of negative examples covered by the rule in the validation set Pruning method: delete any final sequence of conditions that maximizes v Data Mining Sanjay Ranka Fall 2003 26 13

Direct Method: RIPPER Building a Rule Set: Use sequential covering algorithm Finds the best rule that covers the current set of positive examples Eliminate both positive and negative examples covered by the rule Each time a rule is added to the rule set, compute the description length Stop adding new rules when the new description length is d bits longer than the smallest description length obtained so far. d is often chosen as 64 bits Data Mining Sanjay Ranka Fall 2003 27 Direct Method: RIPPER Optimize the rule set: For each rule r in the rule set R Consider 2 alternative rules: Replacement rule (r*): grow new rule from scratch Revised rule (r ): add conjuncts to extend the rule r Compare the rule set for r against the rule set for r* and r Choose rule set that minimizes MDL principle Repeat rule generation and rule optimization for the remaining positive examples Data Mining Sanjay Ranka Fall 2003 28 14

Example Name Give Birth Lay Eggs Can Fly Live in Water Have Legs Class human yes no no no yes mammals python no yes no no no reptiles salmon no yes no yes no fishes whale yes no no yes no mammals frog no yes no sometimes yes amphibians komodo no yes no no yes reptiles bat yes no yes no yes mammals pigeon no yes yes no yes birds cat yes no no no yes mammals leopard shark yes no no yes no fishes turtle no yes no sometimes yes reptiles penguin no yes no sometimes yes birds porcupine yes no no no yes mammals eel no yes no yes no fishes salamander no yes no sometimes yes amphibians gila monster no yes no no yes reptiles platypus no yes no no yes mammals owl no yes yes no yes birds dolphin yes no no yes no mammals eagle no yes yes no yes birds Data Mining Sanjay Ranka Fall 2003 29 Yes Mammals Fishes C4.5 rules versus RIPPER Give Birth? Yes No Live In Water? Amphibians No Sometimes Yes Can Fly? C4.5rules: (Give Birth=No, Can Fly=Yes) Birds (Give Birth=No, Live in Water=Yes) Fishes (Give Birth=Yes) Mammals (Give Birth=No, Can Fly=No, Live in Water=No) Reptiles ( ) Amphibians No RIPPER: (Live in Water=Yes) Fishes (Have Legs=No) Reptiles (Give Birth=No, Can Fly=No, Live In Water=No) Reptiles (Can Fly=Yes,Give Birth=No) Birds () Mammals Birds Reptiles Data Mining Sanjay Ranka Fall 2003 30 15

C4.5rules: RIPPER: C4.5rules versus RIPPER PREDICTED CLASS Amphibians Fishes Reptiles Birds Mammals ACTUAL Amphibians 2 0 0 0 0 CLASS Fishes 0 2 0 0 1 Reptiles 1 0 3 0 0 Birds 1 0 0 3 0 Mammals 0 0 1 0 6 PREDICTED CLASS Amphibians Fishes Reptiles Birds Mammals ACTUAL Amphibians 0 0 0 0 2 CLASS Fishes 0 3 0 0 0 Reptiles 0 0 3 0 1 Birds 0 0 1 2 1 Mammals 0 2 1 0 4 Data Mining Sanjay Ranka Fall 2003 31 Eager Learners So far we have learnt that classification involves An inductive step for constructing classification models from data A deductive step for applying the derived model to previously unseen instances For decision tree induction and rule based classifiers, the models are constructed immediately after the training set is provided Such techniques are known as eager learners because they intend to learn the model as soon as possible, once the training data is available Data Mining Sanjay Ranka Fall 2003 32 16

Lazy Learners An opposite strategy would be to delay the process of generalizing the training data until it is needed to classify the unseen instances Techniques that employ such strategy are known as lazy learners An example of lazy learner is the Rote Classifier, which memorizes the entire training data and perform classification only if the attributes of a test instance matches one of the training instances exactly Data Mining Sanjay Ranka Fall 2003 33 Nearest-neighbor Classifiers One way to make the Rote Classifier approach more flexible is to find all training instances that are relatively similar to the test instance. They are called nearest neighbors of the test instance The test instance can then be classified according to the class label of its neighbors If it walks like a duck, quacks like a duck, and looks like a duck, then it s probably a duck Data Mining Sanjay Ranka Fall 2003 34 17

Nearest Neighbor Classifiers Unseen Instance For data set with continuous attributes Requires Set of sorted instances Distance metric to compute distance between instances Value of k, the number of nearest neighbors to retrieve For classification Retrieve the k nearest neighbors Use class labels of the nearest neighbors to determine the class label of the unseen instance (e.g. by taking majority vote) Data Mining Sanjay Ranka Fall 2003 35 Definition of Nearest Neighbor X X X (a) 1-nearest neighbor (b) 2-nearest neighbor (c) 3-nearest neighbor The k-nearest neighbors of an instance x are defined as the data points having the k smallest distances to x Data Mining Sanjay Ranka Fall 2003 36 18

1-nearest Neighbor If k = 1, we can illustrate the decision boundary of each class by using a Voronoi diagram Data Mining Sanjay Ranka Fall 2003 37 Distance Metric Distance metric is required to compute the distance between two instances A nearest neighbor classifier represents each instance as a data point embedded in a d- dimensional space, where d is the number of continuous attributes Euclidean Distance d( p, q) = i ( p i q i 2 ) Weighted Distance Weight factor, w = 1 / d 2 Weight the vote according to the distance Data Mining Sanjay Ranka Fall 2003 38 19

Choosing the value of k If k is too small, classifier is sensitive to noise points If k is too large Computationally intensive Neighborhood may include points from other classes X Data Mining Sanjay Ranka Fall 2003 39 Nearest Neighbor Classifiers Problems with Euclidean distance High dimensional data Curse of dimensionality Can produce counter intuitive results (e.g. text document classification) Solution: Normalization 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 vs. 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Euclidean distance between pairs of un-normalized vectors Data Mining Sanjay Ranka Fall 2003 40 20

Nearest Neighbor Classifiers Other issues Nearest neighbor classifiers are lazy learners It does not build models explicitly Classifying instances is expensive Scaling of attributes Person: (Height in meters, Weight in pounds, Class) Height may vary from 1.5 m to 1.85 m Weight may vary from 90 lbs to 250 lbs Distance measure could be dominated by difference in weights Data Mining Sanjay Ranka Fall 2003 41 21