Data Mining: Classification Jay Urbain, PhD Credits: Tom Mitchell, - - PowerPoint PPT Presentation

data mining classification
SMART_READER_LITE
LIVE PREVIEW

Data Mining: Classification Jay Urbain, PhD Credits: Tom Mitchell, - - PowerPoint PPT Presentation

Data Mining: Classification Jay Urbain, PhD Credits: Tom Mitchell, Machine Learning, CMU Nazli Goharian, IIT/Georgetown Jiawei Han, Micheline Kamber, and Jian Pei, Data Mining 1 1 2 Classification: Basic Concepts n Classifica(on:


slide-1
SLIDE 1

1

1

Data Mining: Classification

Jay Urbain, PhD

Credits: Tom Mitchell, Machine Learning, CMU Nazli Goharian, IIT/Georgetown Jiawei Han, Micheline Kamber, and Jian Pei, Data Mining

slide-2
SLIDE 2

2

slide-3
SLIDE 3

3 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-4
SLIDE 4

4

Supervised vs. Unsupervised Learning

n

Supervised ¡learning ¡(classifica(on) ¡

n Training ¡data ¡(observa(ons, ¡measurements, ¡etc.) ¡is ¡accompanied ¡by ¡labels ¡

indica,ng ¡the ¡class ¡of ¡each ¡observa(on ¡

n New ¡data ¡is ¡classified ¡based ¡on ¡a ¡model ¡built ¡from ¡the ¡training ¡set ¡

n

Supervised ¡learning ¡(regression) ¡

n Training ¡data ¡(observa(ons, ¡measurements, ¡etc.) ¡is ¡accompanied ¡by ¡numeric ¡

  • utput ¡value ¡for ¡each ¡observa(on ¡

n Numeric ¡output ¡values ¡are ¡predicted ¡based ¡on ¡a ¡ ¡model ¡build ¡from ¡the ¡

training ¡set ¡

n

Unsupervised ¡learning ¡(clustering, ¡frequent ¡item ¡sets, ¡subsequences) ¡

n The ¡class ¡labels ¡of ¡training ¡data ¡is ¡unknown ¡ n Given ¡a ¡set ¡of ¡measurements, ¡observa(ons, ¡etc. ¡with ¡the ¡aim ¡of ¡establishing ¡

the ¡existence ¡of ¡classes, ¡associa(ons, ¡or ¡clusters ¡in ¡the ¡data ¡

slide-5
SLIDE 5

5

n Classifica(on ¡ ¡ ¡

n predicts ¡categorical ¡class ¡labels ¡ ¡ n classifies ¡data ¡(constructs ¡a ¡model) ¡based ¡on ¡the ¡training ¡

set ¡and ¡the ¡values ¡(class ¡labels) ¡in ¡a ¡classifying ¡aNribute ¡ and ¡uses ¡it ¡in ¡classifying ¡new ¡data ¡

n Numeric ¡Predic(on ¡ ¡(Regression) ¡

n models ¡con,nuous-­‑valued ¡func,ons, ¡i.e., ¡predicts ¡unknown ¡

  • r ¡missing ¡values ¡ ¡

n Typical ¡applica(ons ¡

n Credit/loan ¡approval: ¡ n Medical ¡diagnosis: ¡if ¡a ¡tumor ¡is ¡cancerous ¡or ¡benign ¡ n Fraud ¡detec(on: ¡if ¡a ¡transac(on ¡is ¡fraudulent ¡ n Web ¡page ¡categoriza(on: ¡which ¡category ¡it ¡is ¡

Prediction Problems: Classification vs. Numeric Prediction

slide-6
SLIDE 6

6

Classification—Two-Step Process

1.

Model ¡construc(on: ¡describing ¡a ¡set ¡of ¡predetermined ¡classes ¡

n Each ¡tuple/sample ¡is ¡assumed ¡to ¡belong ¡to ¡a ¡predefined ¡class, ¡as ¡

determined ¡by ¡the ¡class ¡label ¡aNribute ¡

n The ¡set ¡of ¡tuples ¡used ¡for ¡model ¡construc(on ¡is ¡training ¡set ¡ n The ¡model ¡is ¡represented ¡as ¡a ¡sta(s(cal ¡model, ¡neural ¡net, ¡

classifica(on ¡rules, ¡decision ¡trees, ¡or ¡mathema(cal ¡formulae ¡

2.

Model ¡usage: ¡for ¡classifying ¡future ¡or ¡unknown ¡objects ¡

n Es(mate ¡accuracy ¡of ¡the ¡model ¡

n The ¡known ¡label ¡of ¡test ¡sample ¡is ¡compared ¡with ¡the ¡classified ¡

result ¡from ¡the ¡model ¡

n Accuracy ¡rate ¡is ¡the ¡percentage ¡of ¡test ¡set ¡samples ¡that ¡are ¡

correctly ¡classified ¡by ¡the ¡model ¡

n Test ¡set ¡is ¡independent ¡of ¡training ¡set ¡(otherwise ¡overfi;ng) ¡ ¡

n If ¡the ¡accuracy ¡is ¡acceptable, ¡use ¡the ¡model ¡to ¡classify ¡new ¡data ¡

n

Note: ¡If ¡the ¡test ¡set ¡is ¡used ¡to ¡select ¡models, ¡it ¡is ¡called ¡valida(on ¡(test) ¡set ¡

slide-7
SLIDE 7

7

Process (1): Model Construction

Training Data

NAME RANK YEARS TENURED Mike Assistant Prof 3 no Mary Assistant Prof 7 yes Bill Professor 2 yes Jim Associate Prof 7 yes Dave Assistant Prof 6 no Anne Associate Prof 3 no

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

slide-8
SLIDE 8

8

Process (2): Using the Model in Prediction

Classifier Testing Data

NAME RANK YEARS TENURED Tom Assistant Prof 2 no Merlisa Associate Prof 7 no George Professor 5 yes Joseph Assistant Prof 7 yes

Unseen Data (Jeff, Professor, 4)

Tenured?

slide-9
SLIDE 9

9 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-10
SLIDE 10

Play Tennis?

(Tom Mitchell, Machine Learning)

slide-11
SLIDE 11

Decision Trees (DT)

n Widely used, practical method for inductive inference

(probable from evidence).

n Method for approximating discrete valued functions. n Exhaustively search hypothesis space. n Can be used for representing if-then-else rules.

slide-12
SLIDE 12

DT Representation

n Classify instances by sorting them down a tree from the

root to some leaf node.

n Each node in the tree specifies a test of some attribute

(feature) of the instance.

n Each branch descending from that node represents one of

the possible values for this attribute.

n Leaf node provides classification instance.

slide-13
SLIDE 13

DT Classification

Classifying a sample using a decision tree:

1.

Starting at the root node of the tree

2.

Test the attribute specified by this node.

3.

Move down the tree branch corresponding to the value of the attribute in the given example.

4.

Repeat process for each subtree rooted at the new node.

5.

Each leaf represents classification of instance.

slide-14
SLIDE 14

DT for Play Tennis

slide-15
SLIDE 15

Play Tennis Example

n How to classify?:

n {outlook=sunny, temperature=hot, humidity=high,

wind=strong}

n Decision trees represent a disjunction of conjunctions of

the attribute values of instances.

n For positive classification, the previous decision tree

corresponds to: (outlook=sunny ^ humidity=high) v (outlook=overcast) v (outlook=rain ^ wind=weak)

slide-16
SLIDE 16

Predict C-Section Risk Example

slide-17
SLIDE 17

Appropriate problems DT’s

n Instances describable by attribute-value pairs n Target function is discrete values

n

Note DT's can be modified to handle real valued parameters.

n Disjunctive hypothesis may be required n Possibly noisy training data n Examples:

n Gene expression n Equipment, or medical diagnosis n Credit risk analysis n Modeling calendar scheduling preferences n Skeletal tracking (random forests)

slide-18
SLIDE 18

Top-down induction (creation) of DTs

Main loop:

1.

A <- select the “best” decision attribute for next node

2.

Assign A as decision attribute for node

3.

For each value of A, create new descendant of node

4.

Sort training examples to current leaf nodes

5.

If training examples perfectly classified, then STOP

6.

Else iterate over new leaf nodes

Note: Show how samples are sorted

slide-19
SLIDE 19

Which attribute is best?

slide-20
SLIDE 20

Entropy

Given S, a set of training examples:

n Entropy measures the

impurity of S

n p+ is proportion of positive

examples of S

n p- is proportion of negative

examples of S

slide-21
SLIDE 21

Entropy

Entropy(S) = expected number of bits needed to encode class(+/-) of randomly drawn member of S (under the optimal, shortest-length code)

n MDL – minimum description length

Why? Information theory (Claude Shannon): optimal length code assigns

  • log2p bits to message having probability p.

So, expected number of bits to encode + or – examples of random member

  • f S:
slide-22
SLIDE 22

Information Gain

Gain(S,A) = expected reduction in entropy due to sorting of A

slide-23
SLIDE 23

Calculating Info Gain (Humidity)

entropy(s) 0.940286 // 9/14*(-LOG(9/14,2))+5/14*(-LOG(5/14,2)) entropy (s, humidity for high) 0.985228 // 3/7*(-LOG(3/7,2))+4/7*(-LOG(4/7,2)) entropy (s, humidity for normal) 0.591673 // 6/7*(-LOG(6/7,2))+1/7*(-LOG(1/7,2)) Gain(S, Humidity) = entropy(s) - 7/14*entropy (s, humidity for high) - 7/14*entropy (s, humidity for normal) Gain(S, Humidity) = 0.151836 // D2- 7/14*D4 - 7/14*D6

slide-24
SLIDE 24

Training Examples

slide-25
SLIDE 25

Selecting the Next Attribute

slide-26
SLIDE 26
slide-27
SLIDE 27

Decision tree learning

n

Aim: find a small tree consistent with the training examples

n

Idea: (recursively) choose "most significant" attribute as root of (sub)tree

slide-28
SLIDE 28

Hypothesis Space Search by ID3

slide-29
SLIDE 29

Hypothesis Space Search by ID3

n

Hypothesis space is complete!

n Target function is surely in there…

n

Outputs a single hypothesis

n

No backtracking

n Local minima

n

Statically based search choices

n Robust to noisy data

n

Inductive bias: approximate “prefer shortest tree”

slide-30
SLIDE 30

Inductive Bias of ID3

Note H is the power set of instances X

n Unbiased?

Not really…

n Prefer short trees, and for those with high info gain

attributes near the root

n Bias is a preference for some hypothesis, rather than a

restriction of hypothesis space H

n Occam’s razor: prefer the shortest hypothesis that fits the

data.

slide-31
SLIDE 31

Occam’s Razor

Why prefer short hypotheses? Argument in favor:

n

Fewer short hypo’s than long hypo’s

n

A short hypo that fits data unlikely to be coincidence

n

A long hypo that fits data might be coincidence Argument opposed:

n

There are many ways to define small sets of hypo’s

n e.g., all trees with a prime number of nodes use attributes with “Z”

n

What’s so special about small sets based on size of hypothesis?

slide-32
SLIDE 32

Overfitting in Decision Trees

Consider adding noisy training example D15:

n Sunny, Hot, Normal, Strong, Play tennis=No

slide-33
SLIDE 33

Overfitting

n Consider error of hypothesis h over:

n Training data: errortrain(h) n Entire distribution D of data: errorD(h)

n Hypothesis h ϵ H overfits training data if there is an

alternative hypothesis h’ ϵ H such that:

slide-34
SLIDE 34

Overfitting

slide-35
SLIDE 35

Avoiding Overfitting

Avoid Overfitting:

  • 1. Stop growing when data split is not statistically significant
  • 2. Grow full tree, then prune
  • 3. Grow many trees w/ randomly selected reduced numbers
  • f attributes, learn function to weight trees (Random

Forests – state of the art technique) How to select best tree:

n Measure performance over training data n Measure performance over separate validation set

Minimum Description Length

n MDL: minimize (size(tree)+size(misclassification))

slide-36
SLIDE 36

Reduced-Error Pruning

n

Start with completed tree

n

Split data into training and validation set

n

Do until further pruning is harmful:

1.

Evaluate impact on validation set of pruning each possible node (plus those below it)

2.

Greedily remove the one that most improves validation set accuracy

n

Produces smallest version of most accurate subtree

slide-37
SLIDE 37

Rule Post-Pruning

1.

Convert tree to equivalent rules

2.

Prune each rule independently of others

3.

Evaluate impact on validation set

4.

Sort final rule into desired sequence of use.

n

Most frequently used method, C4.5

slide-38
SLIDE 38

Summary

n Learning needed for unknown environments n For supervised learning, the aim is to find a simple

hypothesis approximately consistent with training examples that performs well on unseen data

n Decision tree learning using information gain n Learning performance = prediction accuracy measured on

test set

n Overfitting hampers a machine learners ability to

generalize to unseen examples

slide-39
SLIDE 39

STOP DT

39

slide-40
SLIDE 40

40 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-41
SLIDE 41

41

Bayesian Classification: Why?

n A ¡sta(s(cal ¡classifier: ¡performs ¡probabilis,c ¡predic,on, ¡i.e., ¡

predicts ¡class ¡membership ¡probabili(es ¡

n Founda(on: ¡Based ¡on ¡Bayes’ ¡Theorem. ¡ ¡ n Performance: ¡A ¡simple ¡Bayesian ¡classifier, ¡naïve ¡Bayes, ¡makes ¡

strong ¡independence ¡assump(ons, ¡but ¡can ¡perform ¡well. ¡

n Comparable ¡performance ¡with ¡basic ¡decision ¡trees ¡and ¡selected ¡

neural ¡network ¡classifiers ¡

n Incremental: ¡Each ¡training ¡example ¡can ¡incrementally ¡increase/

decrease ¡the ¡probability ¡that ¡a ¡hypothesis ¡is ¡correct ¡(online ¡ learning) ¡— ¡prior ¡knowledge ¡can ¡be ¡combined ¡with ¡observed ¡data ¡

n Standard: ¡Provides ¡a ¡theore(cally ¡sound ¡standard ¡of ¡op(mal ¡

decision ¡for ¡which ¡other ¡methods ¡can ¡be ¡measured ¡

slide-42
SLIDE 42

April 13, 2015 42

Naïve Bayes Classifier

n Bayes theorem n Combines probability of each feature with respect to a

class label.

n Makes strong independence assumption between

features, i.e., independence between features

n Sample applications:

n Classify email as spam based on sender, and text n Diagnose meningitis based on chest-xray, symptom n Classify fruit from shape and color n Determine life style from education and salary

slide-43
SLIDE 43

April 13, 2015 43

Review conditional probability

n Can factor joint probability using the chain rule:

P(a ^ b) = P(a | b) P(b) = P(b | a) P(a)

n And express the joint probability by conditioning on a or b:

P(a | b) P(b) = P(b | a) P(a)

n … and derive Bayes Theorem:

P(a | b) = P(b | a) P(a)/ P(b) P(b | a) = P(a | b) P(b)/ P(a)

slide-44
SLIDE 44

April 13, 2015 44

Naïve Bayes Classifier

n

Lets say we have a hypothesis H, & we want to calculate the probability of the hypothesis being correct.

n

Hypothesis: given feature x1, x2 => object is a Peach

n

Calculate probability that x1, x2 is a Peach

n

P(H: x1, x2 is a Peach)

n

P(H: x1, x2 is an Apricot)

1.

Calculate each of these probabilities

2.

Choose the highest probability

slide-45
SLIDE 45

April 13, 2015 45

Naïve Bayes Classifier

n

P(H|X) Posterior probability of hypothesis H

n

X: {x1, x2…, xn}

n

Shows the confidence/probability of H given X

n

x1: shape=round, x2: color=orange

n

H: x1, x2 is a peach

  • P(H) Prior probability of hypothesis H
  • Represents the probability of H just happening,

regardless of data.

  • E.g. What is the probability of picking a peach from

a fruit bin without knowledge of shape and color.

slide-46
SLIDE 46

April 13, 2015 46

Bayes Theorem - Learning

n

P(X|H) Likelihood - the evidence X conditioned on hypothesis H

n

Shows the confidence (probability) of X given H

n

Given H is true (X is a peach) calculate probability that X is round and orange, i.e., x1=round, x2=orange.

  • P(X) Prior probability of X
  • Represents the probability that sample is round and
  • range.
slide-47
SLIDE 47

April 13, 2015 47

Bayes Theorem - Classification

Likelihood

slide-48
SLIDE 48

April 13, 2015 48

Naïve Bayes Classification

n Hypothesis H is the class Ci.

n Note: P (X) can be ignored (for classification) as it

is constant for all classes.

n Assuming the independence assumption, P(X|Ci) is: n Therefore: n P(Ci) is the ratio of total samples in class Ci to all

samples.

slide-49
SLIDE 49

April 13, 2015 49

Naïve Bayes Classification

n For categorical attribute:

n P(xk|Ci) is the frequency of samples having value xk

in class Ci

n For continuous (numeric) attribute:

n P(xk|Ci) is calculated via a Gaussian density function.

with a mean µ and standard deviation σ

2 2

2 ) (

2 1 ) , , (

σ µ

σ π σ µ

− −

=

x

e x g

) , , ( ) | (

i i

C C k

x g Ci P σ µ = X

slide-50
SLIDE 50

April 13, 2015 50

Naïve Bayes Classification

n

Having pre-calculated allP(xk|Ci), an unknown example X is classified as follows:

1.

For all classes calculate P(Ci|X)

2.

Assign X to the class with the highest P(Ci|X)

slide-51
SLIDE 51

April 13, 2015 51

Play Tennis?

An incoming sample: X = <sunny, cool, high, true>

slide-52
SLIDE 52

April 13, 2015 52

Play Tennis Example: estimating P(xi| C)

slide-53
SLIDE 53

April 13, 2015 53

Play Tennis Example: estimating P(Ci|xi)

n An incoming sample: X = <sunny, cool, high, true> n P(play|X) = P(X|p)*P(p) =

P(p)*P(sunny|p)*P(cool|p)*P(high|p)*p(true|p) 9/14 * 2/9 * 3/9 * 3/9 * 3/9= 0.0053

n P(no play|X) = P(X|p)*P(n) =

P(n)*P(sunny|n)*P(cool|n)*P(high|n)*p(true|n) 5/14 * 3/5 * 1/5 * 4/5 * 3/5 = 0.0206 Class n (no play) has higher probability than class p (play) for example X.

slide-54
SLIDE 54

54

Avoiding the Zero-Probability Problem

n Naïve ¡Bayesian ¡predic(on ¡requires ¡each ¡condi(onal ¡prob. ¡be ¡

non-­‑zero. ¡ ¡Otherwise, ¡the ¡predicted ¡prob. ¡will ¡be ¡zero ¡ ¡ ¡

n Ex. ¡Suppose ¡a ¡dataset ¡with ¡1000 ¡tuples, ¡income=low ¡(0), ¡

income= ¡medium ¡(990), ¡and ¡income ¡= ¡high ¡(10) ¡

n Use ¡Laplacian ¡correc2on ¡(or ¡Laplacian ¡smoothing) ¡

n Adding ¡1 ¡to ¡each ¡case ¡

Prob(income ¡= ¡low) ¡= ¡(0+1)/(1000+3) ¡= ¡1/1003 ¡ Prob(income ¡= ¡medium) ¡= ¡991/1003 ¡ Prob(income ¡= ¡high) ¡= ¡11/1003 ¡

n The ¡“corrected” ¡prob. ¡es(mates ¡are ¡close ¡to ¡their ¡

“uncorrected” ¡counterparts ¡ ∏ = = n k Ci xk P Ci X P 1 ) | ( ) | (

slide-55
SLIDE 55

55

Avoiding the Zero-Probability Problem

n Standard ¡approach: ¡use ¡logarithms ¡ n Log ¡of ¡products ¡is ¡sum ¡of ¡logs ¡

P(C | X) ≈ log 2( P( k x | i C ) k = 1 n ∏ ) = log 2((P( k x | i C ))

slide-56
SLIDE 56

56

Naïve Bayes Classifier: Comments

n Advantages ¡ ¡

n Easy ¡to ¡implement ¡ ¡ n Good ¡results ¡obtained ¡in ¡most ¡of ¡the ¡cases ¡

n Disadvantages ¡

n Assump(on: ¡class ¡condi(onal ¡independence, ¡therefore ¡loss ¡of ¡

accuracy ¡

n Prac(cally, ¡dependencies ¡exist ¡among ¡variables ¡ ¡

n E.g., ¡ ¡hospitals: ¡pa(ents: ¡Profile: ¡age, ¡family ¡history, ¡etc. ¡ ¡

¡Symptoms: ¡fever, ¡cough ¡etc., ¡Disease: ¡lung ¡cancer, ¡

diabetes, ¡etc. ¡ ¡

n Dependencies ¡among ¡these ¡cannot ¡be ¡modeled ¡by ¡Naïve ¡

Bayes ¡Classifier ¡

n How ¡to ¡deal ¡with ¡these ¡dependencies? ¡Bayesian ¡Belief ¡Networks ¡

slide-57
SLIDE 57

57 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-58
SLIDE 58

58

Using IF-THEN Rules for Classification

n

Represent ¡the ¡knowledge ¡in ¡the ¡form ¡of ¡IF-­‑THEN ¡rules ¡ R: ¡ ¡IF ¡age ¡= ¡youth ¡AND ¡student ¡= ¡yes ¡ ¡THEN ¡buys_computer ¡= ¡yes ¡

n Rule ¡antecedent/precondi(on ¡vs. ¡rule ¡consequent ¡

n

Assessment ¡of ¡a ¡rule: ¡coverage ¡(support) ¡and ¡accuracy ¡(confidence) ¡

n ncovers ¡= ¡# ¡of ¡tuples ¡covered ¡by ¡R ¡ n ncorrect ¡= ¡# ¡of ¡tuples ¡correctly ¡classified ¡by ¡R ¡

coverage(R) ¡= ¡ncovers ¡/|D| ¡ ¡ ¡/* ¡D: ¡training ¡data ¡set ¡*/ ¡ accuracy(R) ¡= ¡ncorrect ¡/ ¡ncovers ¡

n

If ¡more ¡than ¡one ¡rule ¡are ¡triggered, ¡need ¡conflict ¡resolu2on ¡or ¡priority ¡scheme ¡

n Size ¡ordering: ¡assign ¡the ¡highest ¡priority ¡to ¡the ¡triggering ¡rules ¡that ¡has ¡the ¡

“toughest” ¡most ¡specific ¡requirement ¡(i.e., ¡most ¡aCribute ¡tests) ¡

n Class-­‑based ¡ordering: ¡decreasing ¡order ¡of ¡prevalence ¡or ¡misclassifica,on ¡

cost ¡per ¡class ¡

n Rule-­‑based ¡ordering ¡(decision ¡list): ¡rules ¡are ¡organized ¡into ¡one ¡long ¡

priority ¡list, ¡according ¡to ¡some ¡measure ¡of ¡rule ¡quality ¡or ¡by ¡experts ¡

slide-59
SLIDE 59

59

age? student? credit rating?

<=30 >40

no yes yes yes

31..40

n

  • fair

excellent yes no n

Example: ¡Rule ¡extrac(on ¡from ¡our ¡buys_computer ¡decision-­‑tree ¡ IF ¡age ¡= ¡young ¡AND ¡student ¡= ¡no ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡THEN ¡buys_computer ¡= ¡no ¡ IF ¡age ¡= ¡young ¡AND ¡student ¡= ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡THEN ¡buys_computer ¡= ¡yes ¡ IF ¡age ¡= ¡mid-­‑age ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡THEN ¡buys_computer ¡= ¡yes ¡ IF ¡age ¡= ¡old ¡AND ¡credit_ra,ng ¡= ¡excellent ¡ ¡THEN ¡buys_computer ¡= ¡no ¡ IF ¡age ¡= ¡old ¡AND ¡credit_ra,ng ¡= ¡fair ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡THEN ¡buys_computer ¡= ¡yes ¡

Rule Extraction from a Decision Tree

n

Rules ¡are ¡easier ¡to ¡understand ¡than ¡large ¡trees ¡

n

One ¡rule ¡is ¡created ¡for ¡each ¡path ¡from ¡the ¡root ¡to ¡a ¡ leaf ¡

n

Each ¡aNribute-­‑value ¡pair ¡along ¡a ¡path ¡forms ¡a ¡ conjunc(on: ¡the ¡leaf ¡holds ¡the ¡class ¡predic(on ¡ ¡

n

Rules ¡are ¡mutually ¡exclusive ¡and ¡exhaus(ve ¡

slide-60
SLIDE 60

60

Rule Induction: Sequential Covering Method

n

Sequen(al ¡covering ¡algorithm: ¡Extracts ¡rules ¡directly ¡from ¡training ¡data ¡

n

Typical ¡sequen(al ¡covering ¡algorithms: ¡FOIL, ¡AQ, ¡CN2, ¡RIPPER ¡

n

Rules ¡are ¡learned ¡sequen,ally, ¡each ¡for ¡a ¡given ¡class ¡Ci ¡will ¡cover ¡many ¡tuples ¡

  • f ¡Ci ¡but ¡none ¡(or ¡few) ¡of ¡the ¡tuples ¡of ¡other ¡classes ¡

n

Steps: ¡ ¡

n Rules ¡are ¡learned ¡one ¡at ¡a ¡(me ¡ n Each ¡(me ¡a ¡rule ¡is ¡learned, ¡the ¡tuples ¡covered ¡by ¡the ¡rules ¡are ¡removed ¡ n Repeat ¡the ¡process ¡on ¡the ¡remaining ¡tuples ¡un(l ¡termina,on ¡condi,on, ¡

e.g., ¡when ¡there ¡are ¡no ¡more ¡training ¡examples, ¡or ¡when ¡the ¡quality ¡of ¡a ¡ rule ¡returned ¡is ¡below ¡a ¡user-­‑specified ¡threshold ¡

slide-61
SLIDE 61

61

Sequential Covering Algorithm

¡ ¡while ¡(enough ¡target ¡tuples ¡leg) ¡

¡generate ¡a ¡rule ¡ ¡remove ¡posi(ve ¡target ¡tuples ¡sa(sfying ¡this ¡rule ¡

Examples covered by Rule 3 Examples covered by Rule 2 Examples covered by Rule 1 Positive examples

slide-62
SLIDE 62

62

Rule Generation

n To ¡generate ¡a ¡rule ¡

while(true) ¡ ¡find ¡the ¡best ¡predicate ¡p ¡ ¡if ¡foil-­‑gain(p) ¡> ¡threshold ¡then ¡add ¡p ¡to ¡current ¡rule ¡ ¡else ¡break ¡

Positive examples Negative examples A3=1 A3=1&&A1=2 A3=1&&A1=2 &&A8=5

slide-63
SLIDE 63

63

How to Learn-One-Rule?

n Start ¡with ¡the ¡most ¡general ¡rule ¡possible: ¡condi,on ¡= ¡empty ¡ n Add ¡new ¡aCributes ¡by ¡adop(ng ¡a ¡greedy ¡depth-­‑first ¡strategy ¡

n Picks ¡the ¡aNribute ¡that ¡most ¡improves ¡the ¡rule ¡quality ¡

n Rule-­‑Quality ¡measures: ¡consider ¡both ¡coverage ¡and ¡accuracy ¡

n Foil-­‑gain ¡(in ¡FOIL ¡& ¡RIPPER): ¡assesses ¡info_gain ¡by ¡extending ¡

condi(on: ¡

n favors ¡rules ¡that ¡have ¡high ¡accuracy ¡and ¡cover ¡many ¡posi,ve ¡tuples ¡

n Rule ¡pruning ¡based ¡on ¡an ¡independent ¡set ¡of ¡test ¡tuples ¡

¡ ¡

Pos/neg ¡are ¡# ¡of ¡posi(ve/nega(ve ¡tuples ¡covered ¡by ¡R. ¡ If ¡FOIL_Prune ¡is ¡higher ¡for ¡the ¡pruned ¡version ¡of ¡R, ¡prune ¡R ¡

) log ' ' ' (log ' _

2 2

neg pos pos neg pos pos pos Gain FOIL + − + × =

neg pos neg pos R Prune FOIL + − = ) ( _

pos’, neg’ predicted

slide-64
SLIDE 64

64 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-65
SLIDE 65

Model Evaluation and Selection

n

Evalua(on ¡metrics: ¡How ¡can ¡we ¡measure ¡accuracy? ¡ ¡Other ¡metrics ¡to ¡ consider? ¡

n

Use ¡valida2on ¡test ¡set ¡of ¡class-­‑labeled ¡tuples ¡instead ¡of ¡training ¡set ¡when ¡ assessing ¡accuracy ¡

n

Methods ¡for ¡es(ma(ng ¡a ¡classifier’s ¡accuracy: ¡ ¡

n Holdout ¡method, ¡random ¡subsampling ¡ n Cross-­‑valida(on ¡ n Bootstrap ¡

n

Comparing ¡classifiers: ¡

n Confidence ¡intervals ¡ n Cost-­‑benefit ¡analysis ¡and ¡ROC ¡Curves ¡

65 ¡

slide-66
SLIDE 66

Classifier Evaluation Metrics: Confusion Matrix

Actual ¡class\Predicted ¡ class ¡ buy_computer ¡ = ¡ ¡yes ¡ buy_computer ¡ = ¡no ¡ Total ¡ buy_computer ¡= ¡yes ¡ 6954 ¡ 46 ¡ 7000 ¡ buy_computer ¡= ¡no ¡ 412 ¡ 2588 ¡ 3000 ¡ Total ¡ 7366 ¡ 2634 ¡ 10000 ¡

n Given ¡m ¡classes, ¡an ¡entry, ¡CMi,j ¡ ¡in ¡a ¡confusion ¡matrix ¡indicates ¡

# ¡of ¡tuples ¡in ¡class ¡i ¡ ¡that ¡were ¡labeled ¡by ¡the ¡classifier ¡as ¡class ¡j ¡

n May ¡have ¡extra ¡rows/columns ¡to ¡provide ¡totals ¡

Confusion ¡Matrix: ¡

Actual ¡class\Predicted ¡class ¡ C1 ¡ ¬ ¡C1 ¡ C1 ¡ True ¡Posi2ves ¡(TP) ¡ False ¡Nega2ves ¡(FN) ¡ ¬ ¡C1 ¡ False ¡Posi2ves ¡(FP) ¡ True ¡Nega2ves ¡(TN) ¡ Example of Confusion Matrix: BOLD red is correct classification

66 ¡

slide-67
SLIDE 67

Classifier Evaluation Metrics: Accuracy, Error Rate, Sensitivity and Specificity

n Classifier ¡Accuracy: ¡percentage ¡

  • f ¡test ¡set ¡tuples ¡that ¡are ¡

correctly ¡classified ¡ Accuracy ¡= ¡(TP ¡+ ¡TN)/All ¡

n Error ¡rate: ¡1 ¡– ¡accuracy, ¡or ¡

Error ¡rate ¡= ¡(FP ¡+ ¡FN)/All ¡

n Class ¡Imbalance ¡Problem: ¡ ¡

n One ¡class ¡may ¡be ¡rare, ¡e.g. ¡

fraud, ¡or ¡HIV-­‑posi(ve ¡

n Significant ¡majority ¡of ¡the ¡

nega,ve ¡class ¡and ¡minority ¡of ¡ the ¡posi(ve ¡class ¡

n Sensi2vity ¡: ¡True ¡Posi(ve ¡

recogni(on ¡rate ¡

n Sensi2vity ¡= ¡TP/P ¡

n Specificity: ¡True ¡Nega(ve ¡

recogni(on ¡rate ¡

n Specificity ¡= ¡TN/N ¡

A\P ¡ C ¡ ¬C ¡ C ¡ TP ¡ FN ¡ P ¡ ¬C ¡ FP ¡ TN ¡ N ¡ P’ ¡ N’ ¡ All ¡

67 ¡

slide-68
SLIDE 68

Classifier Evaluation Metrics: Precision and Recall, and F-measures

n Precision: ¡exactness ¡– ¡what ¡% ¡of ¡tuples ¡that ¡the ¡classifier ¡

labeled ¡as ¡posi(ve ¡are ¡actually ¡posi(ve ¡

n Recall: ¡completeness ¡– ¡what ¡% ¡of ¡posi(ve ¡tuples ¡did ¡the ¡

classifier ¡label ¡as ¡posi(ve? ¡

n Perfect ¡score ¡is ¡1.0 ¡ n Inverse ¡rela(onship ¡between ¡precision ¡& ¡recall ¡(show ¡curve) ¡ n F ¡measure ¡(F1 ¡or ¡F-­‑score): ¡harmonic ¡mean ¡of ¡precision ¡and ¡

recall, ¡ ¡

n Fß: ¡ ¡weighted ¡measure ¡of ¡precision ¡and ¡recall ¡

n ß ¡= ¡0.5 ¡weighs ¡precision ¡twice ¡the ¡weight ¡of ¡recall ¡

68 ¡

slide-69
SLIDE 69

Classifier Evaluation Metrics: Example

69 ¡

n Precision ¡= ¡90/230 ¡= ¡39.13% ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Recall ¡= ¡90/300 ¡= ¡30.00% ¡

Actual ¡Class\Predicted ¡class ¡ cancer ¡= ¡yes ¡ cancer ¡= ¡no ¡ Total ¡ Recogni(on(%) ¡ cancer ¡= ¡yes ¡ 90 ¡ 210 ¡ 300 ¡ 30.00 ¡(sensi,vity ¡TP/P) ¡ cancer ¡= ¡no ¡ 140 ¡ 9560 ¡ 9700 ¡ 98.56 ¡(specificity ¡TN/N) ¡ Total ¡ 230 ¡ 9770 ¡ 10000 ¡ 96.40 ¡(accuracy ¡TP+TN/ All) ¡

slide-70
SLIDE 70

Evaluating Classifier Accuracy: Holdout & Cross-Validation Methods

n

Holdout ¡method ¡

n Given ¡data ¡is ¡randomly ¡par((oned ¡into ¡two ¡independent ¡sets ¡

n Training ¡set ¡(e.g., ¡2/3) ¡for ¡model ¡construc(on ¡ n Test ¡set ¡(e.g., ¡1/3) ¡for ¡accuracy ¡es(ma(on ¡

n Random ¡sampling: ¡a ¡varia(on ¡of ¡holdout ¡

n Repeat ¡holdout ¡k ¡(mes, ¡accuracy ¡= ¡avg. ¡of ¡the ¡accuracies ¡obtained ¡

¡

n

Cross-­‑valida2on ¡(k-­‑fold, ¡where ¡k ¡= ¡10 ¡is ¡most ¡popular) ¡

n Randomly ¡par((on ¡the ¡data ¡into ¡k ¡mutually ¡exclusive ¡subsets, ¡each ¡

approximately ¡equal ¡size ¡

n At ¡i-­‑th ¡itera(on, ¡use ¡Di ¡as ¡test ¡set ¡and ¡others ¡as ¡training ¡set ¡ n Leave-­‑one-­‑out: ¡k ¡folds ¡where ¡k ¡= ¡# ¡of ¡tuples, ¡for ¡small ¡sized ¡data ¡ n *Stra2fied ¡cross-­‑valida2on*: ¡folds ¡are ¡stra(fied ¡so ¡that ¡class ¡distribu(on ¡in ¡

each ¡fold ¡is ¡approximately ¡the ¡same ¡as ¡the ¡ini(al ¡data ¡

70 ¡

slide-71
SLIDE 71

Evaluating Classifier Accuracy: Bootstrap

n

Bootstrap ¡

n Works ¡well ¡with ¡small ¡data ¡sets ¡ n Samples ¡the ¡given ¡training ¡tuples ¡uniformly ¡with ¡replacement ¡

n i.e., ¡each ¡(me ¡a ¡tuple ¡is ¡selected, ¡it ¡is ¡equally ¡likely ¡to ¡be ¡selected ¡

again ¡and ¡re-­‑added ¡to ¡the ¡training ¡set ¡

n

Several ¡bootstrap ¡methods, ¡a ¡common ¡one ¡is ¡.632 ¡boostrap ¡

n A ¡data ¡set ¡with ¡d ¡tuples ¡is ¡sampled ¡d ¡(mes, ¡with ¡replacement, ¡resul(ng ¡in ¡

a ¡training ¡set ¡of ¡d ¡samples. ¡ ¡The ¡data ¡tuples ¡that ¡did ¡not ¡make ¡it ¡into ¡the ¡ training ¡set ¡end ¡up ¡forming ¡the ¡test ¡set. ¡ ¡About ¡63.2% ¡of ¡the ¡original ¡data ¡ end ¡up ¡in ¡the ¡bootstrap, ¡and ¡the ¡remaining ¡36.8% ¡form ¡the ¡test ¡set ¡(since ¡ (1 ¡– ¡1/d)d ¡≈ ¡e-­‑1 ¡= ¡0.368) ¡

n Repeat ¡the ¡sampling ¡procedure ¡k ¡(mes, ¡overall ¡accuracy ¡of ¡the ¡model: ¡

71 ¡ Note: Training set accuracy Used in model accuracy

slide-72
SLIDE 72

Estimating Confidence Intervals: Classifier Models M1 vs. M2

n Suppose ¡we ¡have ¡2 ¡classifiers, ¡M1 ¡and ¡M2, ¡which ¡one ¡is ¡beNer? ¡ n Use ¡10-­‑fold ¡cross-­‑valida(on ¡to ¡obtain ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡ n These ¡mean ¡error ¡rates ¡are ¡just ¡es,mates ¡of ¡error ¡on ¡the ¡true ¡

popula(on ¡of ¡future ¡data ¡cases ¡

n What ¡if ¡the ¡difference ¡between ¡the ¡2 ¡error ¡rates ¡is ¡just ¡

aNributed ¡to ¡chance? ¡

n Use ¡a ¡test ¡of ¡sta2s2cal ¡significance ¡ n Obtain ¡confidence ¡limits ¡for ¡our ¡error ¡es(mates ¡

72 ¡

slide-73
SLIDE 73

Estimating Confidence Intervals: Null Hypothesis

n Perform ¡10-­‑fold ¡cross-­‑valida(on ¡ n Assume ¡samples ¡follow ¡a ¡t ¡distribu2on ¡with ¡k–1 ¡degrees ¡of ¡

freedom ¡(here, ¡k=10) ¡

n Use ¡t-­‑test ¡(or ¡Student’s ¡t-­‑test) ¡ n Null ¡Hypothesis: ¡M1 ¡& ¡M2 ¡are ¡the ¡same ¡ n If ¡we ¡can ¡reject ¡null ¡hypothesis, ¡then ¡ ¡

n we ¡conclude ¡that ¡the ¡difference ¡between ¡M1 ¡& ¡M2 ¡is ¡

sta2s2cally ¡significant ¡

n Chose ¡model ¡with ¡lower ¡error ¡rate ¡

73 ¡

slide-74
SLIDE 74

Estimating Confidence Intervals: t-test

n If ¡only ¡1 ¡test ¡set ¡available: ¡pairwise ¡comparison ¡

n For ¡ith ¡round ¡of ¡10-­‑fold ¡cross-­‑valida(on, ¡the ¡same ¡cross ¡

par((oning ¡is ¡used ¡to ¡obtain ¡err(M1)i ¡and ¡err(M2)i ¡

n Average ¡over ¡10 ¡rounds ¡to ¡get ¡ ¡

n t-­‑test ¡computes ¡t-­‑sta2s2c ¡with ¡k-­‑1 ¡degrees ¡of ¡

freedom: ¡

n If ¡two ¡test ¡sets ¡available: ¡use ¡non-­‑paired ¡(2-­‑sample) ¡t-­‑test ¡

where

and

where where k1 & k2 are # of cross-validation samples used for M1 & M2, resp.

74 ¡

slide-75
SLIDE 75

Estimating Confidence Intervals: Table for t-distribution

n

Symmetric ¡

n

Significance ¡level, ¡e.g., ¡sig ¡ = ¡0.05 ¡or ¡5% ¡means ¡M1 ¡& ¡ M2 ¡are ¡significantly ¡ different ¡for ¡95% ¡of ¡ popula(on ¡

n

Confidence ¡limit, ¡z ¡= ¡sig/2 ¡

75 ¡

slide-76
SLIDE 76

Estimating Confidence Intervals: Statistical Significance

n

Are ¡M1 ¡& ¡M2 ¡significantly ¡different? ¡

n Compute ¡t. ¡Select ¡significance ¡level ¡(e.g. ¡sig ¡= ¡5%) ¡ n Consult ¡table ¡for ¡t-­‑distribu(on: ¡Find ¡t ¡value ¡corresponding ¡to ¡k-­‑1 ¡degrees

¡

  • f ¡freedom ¡(here, ¡9) ¡

n t-­‑distribu(on ¡is ¡symmetric: ¡typically ¡upper ¡% ¡points ¡of ¡distribu(on ¡

shown ¡→ ¡look ¡up ¡value ¡for ¡confidence ¡limit ¡z=sig/2 ¡(here, ¡0.025) ¡

n If ¡t ¡> ¡z ¡or ¡t ¡< ¡-­‑z, ¡then ¡t ¡value ¡lies ¡in ¡rejec(on ¡region: ¡

n Reject ¡null ¡hypothesis ¡that ¡mean ¡error ¡rates ¡of ¡M1 ¡& ¡M2 ¡are ¡same ¡ n Conclude: ¡sta(s(cally ¡significant ¡difference ¡between ¡M1 ¡& ¡M2 ¡ ¡

n Otherwise, ¡conclude ¡that ¡any ¡difference ¡is ¡chance ¡

76 ¡

slide-77
SLIDE 77

Model Selection: ROC Curves

n

ROC ¡(Receiver ¡Opera(ng ¡Characteris(cs) ¡ curves: ¡for ¡visual ¡comparison ¡of ¡classifica(on ¡ models ¡

n

Originated ¡from ¡signal ¡detec(on ¡theory ¡

n

Shows ¡the ¡trade-­‑off ¡between ¡the ¡true ¡posi(ve ¡ rate ¡and ¡the ¡false ¡posi(ve ¡rate ¡

n

The ¡area ¡under ¡the ¡ROC ¡curve ¡is ¡a ¡measure ¡of ¡ the ¡accuracy ¡of ¡the ¡model ¡

n

Rank ¡the ¡test ¡tuples ¡in ¡decreasing ¡order: ¡the ¡

  • ne ¡that ¡is ¡most ¡likely ¡to ¡belong ¡to ¡the ¡posi(ve ¡

class ¡appears ¡at ¡the ¡top ¡of ¡the ¡list ¡

n

The ¡closer ¡to ¡the ¡diagonal ¡line ¡(i.e., ¡the ¡closer ¡ the ¡area ¡is ¡to ¡0.5), ¡the ¡less ¡accurate ¡is ¡the ¡ model ¡

n

Ver(cal ¡axis ¡represents ¡ the ¡true ¡posi(ve ¡rate ¡

n

Horizontal ¡axis ¡rep. ¡the ¡ false ¡posi(ve ¡rate ¡

n

The ¡plot ¡also ¡shows ¡a ¡ diagonal ¡line ¡

n

A ¡model ¡with ¡perfect ¡ accuracy ¡will ¡have ¡an ¡area ¡

  • f ¡1.0 ¡

77 ¡

slide-78
SLIDE 78

Issues Affecting Model Selection

n

Accuracy ¡

n classifier ¡accuracy: ¡predic(ng ¡class ¡label ¡

n

Speed ¡

n (me ¡to ¡construct ¡the ¡model ¡(training ¡(me) ¡ n (me ¡to ¡use ¡the ¡model ¡(classifica(on/predic(on ¡(me) ¡

n

Robustness: ¡handling ¡noise ¡and ¡missing ¡values ¡

n

Scalability: ¡efficiency ¡in ¡disk-­‑resident ¡databases ¡ ¡

n

Interpretability ¡

n understanding ¡and ¡insight ¡provided ¡by ¡the ¡model ¡

n

Other ¡measures, ¡e.g., ¡goodness ¡of ¡rules, ¡such ¡as ¡decision ¡tree ¡size ¡or ¡ compactness ¡of ¡classifica(on ¡rules ¡

78 ¡

slide-79
SLIDE 79

79 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-80
SLIDE 80

Ensemble Methods: Increasing the Accuracy

n

Ensemble ¡methods ¡

n Use ¡a ¡combina,on ¡of ¡models ¡to ¡increase ¡accuracy ¡ n Combine ¡a ¡series ¡of ¡k ¡learned ¡models, ¡M1, ¡M2, ¡…, ¡Mk, ¡with ¡the ¡aim ¡of ¡

crea(ng ¡an ¡improved ¡model ¡M* ¡

n

Popular ¡ensemble ¡methods ¡

n Bagging: ¡averaging ¡the ¡predic(on ¡over ¡a ¡collec(on ¡of ¡classifiers ¡ n Boos(ng: ¡weighted ¡vote ¡with ¡a ¡collec(on ¡of ¡classifiers ¡ n Ensemble: ¡combining ¡a ¡set ¡of ¡heterogeneous ¡classifiers ¡

80 ¡

slide-81
SLIDE 81

Bagging: Boostrap Aggregation

n

Analogy: ¡Diagnosis ¡based ¡on ¡mul(ple ¡doctors’ ¡majority ¡vote ¡

n

Training ¡

n Given ¡a ¡set ¡D ¡of ¡d ¡tuples, ¡at ¡each ¡itera(on ¡i, ¡a ¡training ¡set ¡Di ¡of ¡d ¡tuples ¡is ¡

sampled ¡with ¡replacement ¡from ¡D ¡(i.e., ¡bootstrap) ¡

n A ¡classifier ¡model ¡Mi ¡is ¡learned ¡for ¡each ¡training ¡set ¡Di ¡

n

Classifica(on: ¡classify ¡an ¡unknown ¡sample ¡X ¡ ¡

n Each ¡classifier ¡Mi ¡returns ¡its ¡class ¡predic(on ¡ n The ¡bagged ¡classifier ¡M* ¡counts ¡the ¡votes ¡and ¡assigns ¡the ¡class ¡with ¡the ¡

most ¡votes ¡to ¡X ¡

n

Predic(on: ¡can ¡be ¡applied ¡to ¡the ¡predic(on ¡of ¡con(nuous ¡values ¡by ¡taking ¡ the ¡average ¡value ¡of ¡each ¡predic(on ¡for ¡a ¡given ¡test ¡tuple ¡

n

Accuracy ¡

n Ogen ¡significantly ¡beNer ¡than ¡a ¡single ¡classifier ¡derived ¡from ¡D ¡ n For ¡noisy ¡data: ¡not ¡considerably ¡worse, ¡more ¡robust ¡ ¡ n Proved ¡improved ¡accuracy ¡in ¡predic(on ¡

81 ¡

slide-82
SLIDE 82

Boosting

n

Analogy: ¡Consult ¡several ¡doctors, ¡based ¡on ¡a ¡combina(on ¡of ¡weighted ¡ diagnoses—weight ¡assigned ¡based ¡on ¡the ¡previous ¡diagnosis ¡accuracy ¡

n

How ¡boos(ng ¡works? ¡

n

Weights ¡are ¡assigned ¡to ¡each ¡training ¡tuple ¡

n

A ¡series ¡of ¡k ¡classifiers ¡is ¡itera(vely ¡learned ¡

n

Ager ¡a ¡classifier ¡Mi ¡is ¡learned, ¡the ¡weights ¡are ¡updated ¡to ¡allow ¡the ¡ subsequent ¡classifier, ¡Mi+1, ¡to ¡pay ¡more ¡aden2on ¡to ¡the ¡training ¡tuples ¡ that ¡were ¡misclassified ¡by ¡Mi ¡

n

The ¡final ¡M* ¡combines ¡the ¡votes ¡of ¡each ¡individual ¡classifier, ¡where ¡the ¡ weight ¡of ¡each ¡classifier's ¡vote ¡is ¡a ¡func(on ¡of ¡its ¡accuracy ¡

n

Boos(ng ¡algorithm ¡can ¡be ¡extended ¡for ¡numeric ¡predic(on ¡

n

Compared ¡with ¡bagging: ¡Boos(ng ¡tends ¡to ¡have ¡greater ¡accuracy, ¡but ¡it ¡also ¡ risks ¡overfi{ng ¡the ¡model ¡to ¡misclassified ¡data ¡

82 ¡

Note: Weighted Majority

slide-83
SLIDE 83

83 ¡

Adaboost (Freund and Schapire, 1997)

n

Given ¡a ¡set ¡of ¡d ¡class-­‑labeled ¡tuples, ¡(X1, ¡y1), ¡…, ¡(Xd, ¡yd) ¡

n

Ini(ally, ¡all ¡the ¡weights ¡of ¡tuples ¡are ¡set ¡the ¡same ¡(1/d) ¡

n

Generate ¡k ¡classifiers ¡in ¡k ¡rounds. ¡ ¡At ¡round ¡i, ¡

n

Tuples ¡from ¡D ¡are ¡sampled ¡(with ¡replacement) ¡to ¡form ¡a ¡training ¡set ¡ Di ¡of ¡the ¡same ¡size ¡

n

Each ¡tuple’s ¡chance ¡of ¡being ¡selected ¡is ¡based ¡on ¡its ¡weight ¡

n

A ¡classifica(on ¡model ¡Mi ¡is ¡derived ¡from ¡Di ¡

n

Its ¡error ¡rate ¡is ¡calculated ¡using ¡Di ¡as ¡a ¡test ¡set ¡

n

If ¡a ¡tuple ¡is ¡misclassified, ¡its ¡weight ¡is ¡increased, ¡o.w. ¡it ¡is ¡decreased ¡

n

Error ¡rate: ¡err(Xj) ¡is ¡the ¡misclassifica(on ¡error ¡of ¡tuple ¡Xj. ¡Classifier ¡Mi ¡ error ¡rate ¡is ¡the ¡sum ¡of ¡the ¡weights ¡of ¡the ¡misclassified ¡tuples: ¡ ¡

n

The ¡weight ¡of ¡classifier ¡Mi’s ¡vote ¡is ¡ ) ( ) ( 1 log

i i

M error M error −

× =

d j j i

err w M error ) ( ) (

j

X

slide-84
SLIDE 84

Random Forest (Breiman 2001)

n

Random ¡Forest: ¡ ¡

n Each ¡classifier ¡in ¡the ¡ensemble ¡is ¡a ¡decision ¡tree ¡classifier ¡and ¡is ¡

generated ¡using ¡a ¡random ¡selec,on ¡of ¡aCributes ¡at ¡each ¡node ¡to ¡ determine ¡the ¡split ¡

n During ¡classifica(on, ¡each ¡tree ¡votes ¡and ¡the ¡most ¡popular ¡class ¡is ¡

returned ¡

n

Two ¡Methods ¡to ¡construct ¡Random ¡Forest: ¡

n Forest-­‑RI ¡(random ¡input ¡selec,on): ¡ ¡Randomly ¡select, ¡at ¡each ¡node, ¡F ¡

aNributes ¡as ¡candidates ¡for ¡the ¡split ¡at ¡the ¡node. ¡The ¡CART ¡(Gini) ¡or ¡Info ¡ Gain ¡methodology ¡is ¡used ¡to ¡grow ¡the ¡trees ¡to ¡maximum ¡size ¡

n Forest-­‑RC ¡(random ¡linear ¡combina,ons): ¡ ¡Creates ¡new ¡aNributes ¡(or ¡

features) ¡that ¡are ¡a ¡linear ¡combina(on ¡of ¡the ¡exis(ng ¡aNributes ¡(reduces ¡ the ¡correla(on ¡between ¡individual ¡classifiers) ¡

n

Comparable ¡in ¡accuracy ¡to ¡Adaboost, ¡but ¡more ¡robust ¡to ¡errors ¡and ¡outliers ¡ ¡

n

Insensi(ve ¡to ¡the ¡number ¡of ¡aNributes ¡selected ¡for ¡considera(on ¡at ¡each ¡ split, ¡and ¡faster ¡than ¡bagging ¡or ¡boos(ng ¡

84 ¡

slide-85
SLIDE 85

Classification of Class-Imbalanced Data Sets

n

Class-­‑imbalance ¡problem: ¡Rare ¡posi(ve ¡example ¡but ¡numerous ¡nega(ve ¡ones, ¡ e.g., ¡medical ¡diagnosis, ¡fraud, ¡oil-­‑spill, ¡fault, ¡etc. ¡ ¡

n

Tradi(onal ¡methods ¡assume ¡a ¡balanced ¡distribu(on ¡of ¡classes ¡and ¡equal ¡error ¡ costs: ¡not ¡suitable ¡for ¡class-­‑imbalanced ¡data ¡

n

Typical ¡methods ¡for ¡imbalance ¡data ¡in ¡2-­‑class ¡classifica(on: ¡ ¡

n Oversampling: ¡re-­‑sampling ¡of ¡data ¡from ¡posi(ve ¡class ¡ n Under-­‑sampling: ¡randomly ¡eliminate ¡ ¡tuples ¡from ¡nega(ve ¡class ¡ n Threshold-­‑moving: ¡moves ¡the ¡decision ¡threshold, ¡t, ¡so ¡that ¡the ¡rare ¡class ¡

tuples ¡are ¡easier ¡to ¡classify, ¡and ¡hence, ¡less ¡chance ¡of ¡costly ¡false ¡nega(ve ¡ errors ¡

n Ensemble ¡techniques: ¡Ensemble ¡mul(ple ¡classifiers ¡introduced ¡above ¡

n

S(ll ¡difficult ¡for ¡class ¡imbalance ¡problem ¡on ¡mul(class ¡tasks ¡

85 ¡

slide-86
SLIDE 86

86 ¡

Classification: Basic Concepts

n Classifica(on: ¡Basic ¡Concepts ¡ n Decision ¡Tree ¡Induc(on ¡ n Bayes ¡Classifica(on ¡Methods ¡ n Rule-­‑Based ¡Classifica(on ¡ n Model ¡Evalua(on ¡and ¡Selec(on ¡ n Techniques ¡to ¡Improve ¡Classifica(on ¡Accuracy: ¡

Ensemble ¡Methods ¡

n Summary ¡

slide-87
SLIDE 87

Summary (I)

n

Classifica(on ¡is ¡a ¡form ¡of ¡data ¡analysis ¡that ¡extracts ¡models ¡describing ¡ important ¡data ¡classes. ¡ ¡

n

Effec(ve ¡and ¡scalable ¡methods ¡have ¡been ¡developed ¡for ¡decision ¡tree ¡ induc(on, ¡Naive ¡Bayesian ¡classifica(on, ¡rule-­‑based ¡classifica(on, ¡and ¡many ¡

  • ther ¡classifica(on ¡methods. ¡

n

Evalua(on ¡metrics ¡include: ¡accuracy, ¡sensi(vity, ¡specificity, ¡precision, ¡recall, ¡F ¡ measure, ¡and ¡Fß ¡measure. ¡

n

Stra(fied ¡k-­‑fold ¡cross-­‑valida(on ¡is ¡recommended ¡for ¡accuracy ¡es(ma(on. ¡ ¡ ¡

n

Bagging ¡and ¡boos(ng ¡can ¡be ¡used ¡to ¡increase ¡overall ¡accuracy ¡by ¡learning ¡and ¡ combining ¡a ¡series ¡of ¡individual ¡models. ¡

87 ¡

slide-88
SLIDE 88

Summary (II)

n Significance ¡tests ¡and ¡ROC ¡curves ¡are ¡useful ¡for ¡model ¡selec(on. ¡ n There ¡have ¡been ¡numerous ¡comparisons ¡of ¡the ¡different ¡

classifica(on ¡methods; ¡the ¡maNer ¡remains ¡a ¡research ¡topic ¡

n No ¡single ¡method ¡has ¡been ¡found ¡to ¡be ¡superior ¡over ¡all ¡others ¡

for ¡all ¡data ¡sets ¡

n Issues ¡such ¡as ¡accuracy, ¡training ¡(me, ¡robustness, ¡scalability, ¡

and ¡interpretability ¡must ¡be ¡considered ¡and ¡can ¡involve ¡trade-­‑

  • ffs, ¡further ¡complica(ng ¡the ¡quest ¡for ¡an ¡overall ¡superior ¡

method ¡

88 ¡

slide-89
SLIDE 89

References (1)

n

  • C. ¡Apte ¡and ¡S. ¡Weiss. ¡Data ¡mining ¡with ¡decision ¡trees ¡and ¡decision ¡rules. ¡Future ¡

Genera(on ¡Computer ¡Systems, ¡13, ¡1997 ¡

n

  • C. ¡M. ¡Bishop, ¡ ¡Neural ¡Networks ¡for ¡Padern ¡Recogni2on. ¡ ¡Oxford ¡University ¡Press, ¡

1995 ¡

n

  • L. ¡Breiman, ¡J. ¡Friedman, ¡R. ¡Olshen, ¡and ¡C. ¡Stone. ¡Classifica2on ¡and ¡Regression ¡Trees. ¡

Wadsworth ¡Interna(onal ¡Group, ¡1984 ¡

n

  • C. ¡J. ¡C. ¡Burges. ¡A ¡Tutorial ¡on ¡Support ¡Vector ¡Machines ¡for ¡Padern ¡Recogni2on. ¡Data ¡

Mining ¡and ¡Knowledge ¡Discovery, ¡2(2): ¡121-­‑168, ¡1998 ¡

n

  • P. ¡K. ¡Chan ¡and ¡S. ¡J. ¡Stolfo. ¡Learning ¡arbiter ¡and ¡combiner ¡trees ¡from ¡par22oned ¡data ¡

for ¡scaling ¡machine ¡learning. ¡KDD'95 ¡

n

  • H. ¡Cheng, ¡X. ¡Yan, ¡J. ¡Han, ¡and ¡C.-­‑W. ¡Hsu, ¡

Discrimina2ve ¡Frequent ¡Padern ¡Analysis ¡for ¡Effec2ve ¡Classifica2on, ¡ICDE'07 ¡

n

  • H. ¡Cheng, ¡X. ¡Yan, ¡J. ¡Han, ¡and ¡P. ¡S. ¡Yu, ¡

Direct ¡Discrimina2ve ¡Padern ¡Mining ¡for ¡Effec2ve ¡Classifica2on, ¡ICDE'08 ¡

n

  • W. ¡Cohen. ¡ ¡Fast ¡effec2ve ¡rule ¡induc2on. ¡ICML'95 ¡

n

  • G. ¡Cong, ¡K.-­‑L. ¡Tan, ¡A. ¡K. ¡H. ¡Tung, ¡and ¡X. ¡Xu. ¡ ¡Mining ¡top-­‑k ¡covering ¡rule ¡groups ¡for ¡

gene ¡expression ¡data. ¡ ¡SIGMOD'05 ¡

89 ¡

slide-90
SLIDE 90

References (2)

n

  • A. ¡J. ¡Dobson. ¡ ¡An ¡Introduc2on ¡to ¡Generalized ¡Linear ¡Models. ¡ ¡Chapman ¡& ¡Hall, ¡1990. ¡

n

  • G. ¡Dong ¡and ¡J. ¡Li. ¡Efficient ¡mining ¡of ¡emerging ¡paderns: ¡Discovering ¡trends ¡and ¡
  • differences. ¡KDD'99. ¡

n

  • R. ¡O. ¡Duda, ¡P. ¡E. ¡Hart, ¡and ¡D. ¡G. ¡Stork. ¡Padern ¡Classifica2on, ¡2ed. ¡John ¡Wiley, ¡2001 ¡

n

  • U. ¡M. ¡Fayyad. ¡Branching ¡on ¡adribute ¡values ¡in ¡decision ¡tree ¡genera2on. ¡AAAI’94. ¡

n

  • Y. ¡Freund ¡and ¡R. ¡E. ¡Schapire. ¡A ¡decision-­‑theore2c ¡generaliza2on ¡of ¡on-­‑line ¡learning ¡and ¡

an ¡ ¡applica2on ¡to ¡boos2ng. ¡J. ¡Computer ¡and ¡System ¡Sciences, ¡1997. ¡

n

  • J. ¡Gehrke, ¡R. ¡Ramakrishnan, ¡and ¡V. ¡Gan(. ¡Rainforest: ¡A ¡framework ¡for ¡fast ¡decision ¡tree ¡

construc2on ¡of ¡large ¡datasets. ¡VLDB’98. ¡

n

  • J. ¡Gehrke, ¡V. ¡Gant, ¡R. ¡Ramakrishnan, ¡and ¡W.-­‑Y. ¡Loh, ¡BOAT ¡-­‑-­‑ ¡Op2mis2c ¡Decision ¡Tree ¡
  • Construc2on. ¡SIGMOD'99. ¡

n

  • T. ¡Has(e, ¡R. ¡Tibshirani, ¡and ¡J. ¡Friedman. ¡The ¡Elements ¡of ¡Sta2s2cal ¡Learning: ¡Data ¡

Mining, ¡Inference, ¡ ¡and ¡Predic2on. ¡Springer-­‑Verlag, ¡2001. ¡

n

  • D. ¡Heckerman, ¡D. ¡Geiger, ¡and ¡D. ¡M. ¡Chickering. ¡Learning ¡Bayesian ¡networks: ¡The ¡

combina2on ¡of ¡knowledge ¡and ¡sta2s2cal ¡data. ¡Machine ¡Learning, ¡1995. ¡

n

  • W. ¡Li, ¡J. ¡Han, ¡and ¡J. ¡Pei, ¡CMAR: ¡Accurate ¡and ¡Efficient ¡Classifica2on ¡Based ¡on ¡Mul2ple ¡

Class-­‑Associa2on ¡Rules, ¡ICDM'01. ¡ ¡

90 ¡

slide-91
SLIDE 91

References (3)

n

T.-­‑S. ¡Lim, ¡W.-­‑Y. ¡Loh, ¡and ¡Y.-­‑S. ¡Shih. ¡A ¡comparison ¡of ¡predic2on ¡accuracy, ¡complexity, ¡ and ¡training ¡2me ¡of ¡ ¡thirty-­‑three ¡old ¡and ¡new ¡classifica2on ¡algorithms. ¡ ¡Machine ¡ Learning, ¡2000. ¡ ¡

n

  • J. ¡Magidson. ¡ ¡The ¡Chaid ¡approach ¡to ¡segmenta2on ¡modeling: ¡ ¡Chi-­‑squared ¡

automa2c ¡interac2on ¡detec2on. ¡In ¡R. ¡P. ¡Bagozzi, ¡editor, ¡Advanced ¡Methods ¡of ¡ Marke(ng ¡Research, ¡Blackwell ¡Business, ¡1994. ¡

n

  • M. ¡Mehta, ¡R. ¡Agrawal, ¡and ¡J. ¡Rissanen. ¡SLIQ ¡: ¡A ¡fast ¡scalable ¡classifier ¡for ¡data ¡
  • mining. ¡EDBT'96. ¡

n

  • T. ¡M. ¡Mitchell. ¡Machine ¡Learning. ¡McGraw ¡Hill, ¡1997. ¡ ¡

n

  • S. ¡K. ¡Murthy, ¡Automa2c ¡Construc2on ¡of ¡Decision ¡Trees ¡from ¡Data: ¡A ¡Mul2-­‑

Disciplinary ¡Survey, ¡Data ¡Mining ¡and ¡Knowledge ¡Discovery ¡2(4): ¡345-­‑389, ¡1998 ¡

n

  • J. ¡R. ¡Quinlan. ¡Induc2on ¡of ¡decision ¡trees. ¡Machine ¡Learning, ¡1:81-­‑106, ¡1986. ¡ ¡

n

  • J. ¡R. ¡Quinlan ¡and ¡R. ¡M. ¡Cameron-­‑Jones. ¡FOIL: ¡A ¡midterm ¡report. ¡ECML’93. ¡

n

  • J. ¡R. ¡Quinlan. ¡C4.5: ¡Programs ¡for ¡Machine ¡Learning. ¡Morgan ¡Kaufmann, ¡1993. ¡

n

  • J. ¡R. ¡Quinlan. ¡ ¡Bagging, ¡boos2ng, ¡and ¡c4.5. ¡AAAI'96. ¡

91 ¡

slide-92
SLIDE 92

References (4)

n

  • R. ¡Rastogi ¡and ¡K. ¡Shim. ¡Public: ¡A ¡decision ¡tree ¡classifier ¡that ¡integrates ¡building ¡and ¡
  • pruning. ¡VLDB’98. ¡

n

  • J. ¡Shafer, ¡R. ¡Agrawal, ¡and ¡M. ¡Mehta. ¡SPRINT ¡: ¡A ¡scalable ¡parallel ¡classifier ¡for ¡data ¡
  • mining. ¡VLDB’96. ¡

n

  • J. ¡W. ¡Shavlik ¡and ¡T. ¡G. ¡DieNerich. ¡Readings ¡in ¡Machine ¡Learning. ¡Morgan ¡Kaufmann, ¡
  • 1990. ¡

n

  • P. ¡Tan, ¡M. ¡Steinbach, ¡and ¡V. ¡Kumar. ¡Introduc2on ¡to ¡Data ¡Mining. ¡Addison ¡Wesley, ¡
  • 2005. ¡

n

  • S. ¡M. ¡Weiss ¡and ¡C. ¡A. ¡Kulikowski. ¡ ¡Computer ¡Systems ¡that ¡Learn: ¡ ¡Classifica2on ¡and ¡

Predic2on ¡Methods ¡from ¡Sta2s2cs, ¡Neural ¡Nets, ¡Machine ¡Learning, ¡and ¡Expert ¡

  • Systems. ¡ ¡Morgan ¡Kaufman, ¡1991. ¡ ¡

n

  • S. ¡M. ¡Weiss ¡and ¡N. ¡Indurkhya. ¡Predic2ve ¡Data ¡Mining. ¡Morgan ¡Kaufmann, ¡1997. ¡ ¡

n

  • I. ¡H. ¡WiNen ¡and ¡E. ¡Frank. ¡Data ¡Mining: ¡Prac2cal ¡Machine ¡Learning ¡Tools ¡and ¡

Techniques, ¡ ¡2ed. ¡ ¡Morgan ¡Kaufmann, ¡2005. ¡

n

  • X. ¡Yin ¡and ¡J. ¡Han. ¡CPAR: ¡Classifica2on ¡based ¡on ¡predic2ve ¡associa2on ¡rules. ¡SDM'03 ¡

n

  • H. ¡Yu, ¡J. ¡Yang, ¡and ¡J. ¡Han. ¡Classifying ¡large ¡data ¡sets ¡using ¡SVM ¡with ¡hierarchical ¡
  • clusters. ¡KDD'03. ¡

92 ¡

slide-93
SLIDE 93
slide-94
SLIDE 94

94

Decision Tree Induction: An Example

age?

  • vercast

student? credit rating? <=30 >40 no yes yes yes

31..40

no fair excellent yes no

age income student credit_rating buys_computer <=30 high no fair no <=30 high no excellent no 31…40 high no fair yes >40 medium no fair yes >40 low yes fair yes >40 low yes excellent no 31…40 low yes excellent yes <=30 medium no fair no <=30 low yes fair yes >40 medium yes fair yes <=30 medium yes excellent yes 31…40 medium no excellent yes 31…40 high yes fair yes >40 medium no excellent no

q Training ¡data ¡set: ¡Buys_computer ¡ q The ¡data ¡set ¡follows ¡an ¡example ¡of ¡

Quinlan’s ¡ID3 ¡(Playing ¡Tennis) ¡

q Resul(ng ¡tree: ¡

slide-95
SLIDE 95

95

Algorithm for Decision Tree Induction

n Basic ¡algorithm ¡(a ¡greedy ¡algorithm) ¡

n Tree ¡is ¡constructed ¡in ¡a ¡top-­‑down ¡recursive ¡divide-­‑and-­‑

conquer ¡manner ¡

n At ¡start, ¡all ¡the ¡training ¡examples ¡are ¡at ¡the ¡root ¡ n ANributes ¡are ¡categorical ¡(if ¡con(nuous-­‑valued, ¡they ¡are ¡

discre(zed ¡in ¡advance) ¡

n Examples ¡are ¡par((oned ¡recursively ¡based ¡on ¡selected ¡

aNributes ¡

n Test ¡aNributes ¡are ¡selected ¡on ¡the ¡basis ¡of ¡a ¡heuris(c ¡or ¡

sta(s(cal ¡measure ¡(e.g., ¡informa(on ¡gain) ¡

n Condi(ons ¡for ¡stopping ¡par((oning ¡

n All ¡samples ¡for ¡a ¡given ¡node ¡belong ¡to ¡the ¡same ¡class ¡ n There ¡are ¡no ¡remaining ¡aNributes ¡for ¡further ¡par((oning ¡– ¡

majority ¡vo(ng ¡is ¡employed ¡for ¡classifying ¡the ¡leaf ¡

n There ¡are ¡no ¡samples ¡leg ¡

slide-96
SLIDE 96

Brief Review of Entropy

n

96

m = 2

slide-97
SLIDE 97

97

Attribute Selection Measure: Information Gain (ID3/C4.5)

n Select ¡the ¡aNribute ¡with ¡the ¡highest ¡informa(on ¡gain ¡ n Let ¡pi ¡be ¡the ¡probability ¡that ¡an ¡arbitrary ¡tuple ¡in ¡D ¡belongs ¡to ¡

class ¡Ci, ¡es(mated ¡by ¡|Ci, ¡D|/|D| ¡

n Expected ¡informa(on ¡(entropy) ¡needed ¡to ¡classify ¡a ¡tuple ¡in ¡D: ¡ n Informa(on ¡needed ¡(ager ¡using ¡A ¡to ¡split ¡D ¡into ¡v ¡par((ons) ¡to ¡

classify ¡D: ¡

n Informa(on ¡gained ¡by ¡branching ¡on ¡aNribute ¡A ¡

) ( log ) (

2 1 i m i i

p p D Info

=

− =

) ( | | | | ) (

1 j v j j A

D Info D D D Info × = ∑

=

(D) Info Info(D) Gain(A)

A

− =

slide-98
SLIDE 98

98

Attribute Selection: Information Gain

g Class ¡P: ¡buys_computer ¡= ¡“yes” ¡ g Class ¡N: ¡buys_computer ¡= ¡“no” ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡means ¡“age ¡<=30” ¡has ¡5 ¡out ¡of ¡ 14 ¡samples, ¡with ¡2 ¡yes’es ¡ ¡and ¡3 ¡ no’s. ¡ ¡ ¡Hence ¡ ¡ ¡ Similarly, ¡

age pi ni I(pi, ni) <=30 2 3 0.971 31…40 4 >40 3 2 0.971 694 . ) 2 , 3 ( 14 5 ) , 4 ( 14 4 ) 3 , 2 ( 14 5 ) ( = + + = I I I D Infoage

048 . ) _ ( 151 . ) ( 029 . ) ( = = = rating credit Gain student Gain income Gain

246 . ) ( ) ( ) ( = − = D Info D Info age Gain

age

age income student credit_rating buys_computer <=30 high no fair no <=30 high no excellent no 31…40 high no fair yes >40 medium no fair yes >40 low yes fair yes >40 low yes excellent no 31…40 low yes excellent yes <=30 medium no fair no <=30 low yes fair yes >40 medium yes fair yes <=30 medium yes excellent yes 31…40 medium no excellent yes 31…40 high yes fair yes >40 medium no excellent no

) 3 , 2 ( 14 5 I

940 . ) 14 5 ( log 14 5 ) 14 9 ( log 14 9 ) 5 , 9 ( ) (

2 2

= − − = = I D Info

slide-99
SLIDE 99

99

Computing Information-Gain for Continuous-Valued Attributes

n Let ¡aNribute ¡A ¡be ¡a ¡con(nuous-­‑valued ¡aNribute ¡ n Must ¡determine ¡the ¡best ¡split ¡point ¡for ¡A ¡

n Sort ¡the ¡value ¡A ¡in ¡increasing ¡order ¡ n Typically, ¡the ¡midpoint ¡between ¡each ¡pair ¡of ¡adjacent ¡values ¡

is ¡considered ¡as ¡a ¡possible ¡split ¡point ¡

n (ai+ai+1)/2 ¡is ¡the ¡midpoint ¡between ¡the ¡values ¡of ¡ai ¡and ¡ai+1 ¡

n The ¡point ¡with ¡the ¡minimum ¡expected ¡informa,on ¡

requirement ¡for ¡A ¡is ¡selected ¡as ¡the ¡split-­‑point ¡for ¡A ¡

n Split: ¡

n D1 ¡is ¡the ¡set ¡of ¡tuples ¡in ¡D ¡sa(sfying ¡A ¡≤ ¡split-­‑point, ¡and ¡D2 ¡is ¡

the ¡set ¡of ¡tuples ¡in ¡D ¡sa(sfying ¡A ¡> ¡split-­‑point ¡

slide-100
SLIDE 100

100

Gain Ratio for Attribute Selection (C4.5)

n Informa(on ¡gain ¡measure ¡is ¡biased ¡towards ¡aNributes ¡with ¡a ¡

large ¡number ¡of ¡values ¡

n C4.5 ¡(a ¡successor ¡of ¡ID3) ¡uses ¡gain ¡ra(o ¡to ¡overcome ¡the ¡

problem ¡(normaliza(on ¡to ¡informa(on ¡gain) ¡

n GainRa(o(A) ¡= ¡Gain(A)/SplitInfo(A) ¡

n Ex. ¡

n gain_ra(o(income) ¡= ¡0.029/1.557 ¡= ¡0.019 ¡

n The ¡aNribute ¡with ¡the ¡maximum ¡gain ¡ra(o ¡is ¡selected ¡as ¡the ¡

spli{ng ¡aNribute ¡

) | | | | ( log | | | | ) (

2 1

D D D D D SplitInfo

j v j j A

× − = ∑

=

slide-101
SLIDE 101

101

Gini Index (CART, IBM IntelligentMiner)

n If ¡a ¡data ¡set ¡D ¡contains ¡examples ¡from ¡n ¡classes, ¡gini ¡index, ¡

gini(D) ¡is ¡defined ¡as ¡ ¡ ¡ ¡ ¡ ¡ ¡where ¡pj ¡is ¡the ¡rela(ve ¡frequency ¡of ¡class ¡j ¡in ¡D ¡

n If ¡a ¡data ¡set ¡D ¡ ¡is ¡split ¡on ¡A ¡into ¡two ¡subsets ¡D1 ¡and ¡D2, ¡the ¡gini ¡

index ¡gini(D) ¡is ¡defined ¡as ¡

n Reduc(on ¡in ¡Impurity: ¡ n The ¡aNribute ¡provides ¡the ¡smallest ¡ginisplit(D) ¡(or ¡the ¡largest ¡

reduc(on ¡in ¡impurity) ¡is ¡chosen ¡to ¡split ¡the ¡node ¡(need ¡to ¡ enumerate ¡all ¡the ¡possible ¡spli;ng ¡points ¡for ¡each ¡aCribute) ¡ ∑ = − = n j p j D gini 1 2 1 ) (

) ( | | | | ) ( | | | | ) (

2 2 1 1

D gini D D D gini D D D giniA + =

) ( ) ( ) ( D gini D gini A gini

A

− = Δ

slide-102
SLIDE 102

102

Computation of Gini Index

n Ex. ¡ ¡D ¡has ¡9 ¡tuples ¡in ¡buys_computer ¡= ¡“yes” ¡and ¡5 ¡in ¡“no” ¡ n Suppose ¡the ¡aNribute ¡income ¡par((ons ¡D ¡into ¡10 ¡in ¡D1: ¡{low, ¡

medium} ¡and ¡4 ¡in ¡D2 ¡ ¡Gini{low,high} ¡is ¡0.458; ¡Gini{medium,high} ¡is ¡0.450. ¡ ¡Thus, ¡split ¡on ¡the ¡ {low,medium} ¡(and ¡{high}) ¡since ¡it ¡has ¡the ¡lowest ¡Gini ¡index ¡

n All ¡aNributes ¡are ¡assumed ¡con(nuous-­‑valued ¡ n May ¡need ¡other ¡tools, ¡e.g., ¡clustering, ¡to ¡get ¡the ¡possible ¡split ¡

values ¡

n Can ¡be ¡modified ¡for ¡categorical ¡aNributes ¡

459 . 14 5 14 9 1 ) (

2 2

= ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − = D gini

) ( 14 4 ) ( 14 10 ) (

2 1 } , {

D Gini D Gini D gini

medium low income

⎟ ⎠ ⎞ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ =

slide-103
SLIDE 103

103

Comparing Attribute Selection Measures

n The ¡three ¡measures, ¡in ¡general, ¡return ¡good ¡results ¡but ¡

n Informa2on ¡gain: ¡ ¡

n biased ¡towards ¡mul(valued ¡aNributes ¡

n Gain ¡ra2o: ¡ ¡

n tends ¡to ¡prefer ¡unbalanced ¡splits ¡in ¡which ¡one ¡par((on ¡is ¡

much ¡smaller ¡than ¡the ¡others ¡

n Gini ¡index: ¡ ¡

n biased ¡to ¡mul(valued ¡aNributes ¡ n has ¡difficulty ¡when ¡# ¡of ¡classes ¡is ¡large ¡ n tends ¡to ¡favor ¡tests ¡that ¡result ¡in ¡equal-­‑sized ¡par((ons ¡

and ¡purity ¡in ¡both ¡par((ons ¡

slide-104
SLIDE 104

104

Other Attribute Selection Measures

n

CHAID: ¡a ¡popular ¡decision ¡tree ¡algorithm, ¡measure ¡based ¡on ¡χ2 ¡test ¡for ¡ independence ¡

n

C-­‑SEP: ¡performs ¡beNer ¡than ¡info. ¡gain ¡and ¡gini ¡index ¡in ¡certain ¡cases ¡

n

G-­‑sta(s(c: ¡has ¡a ¡close ¡approxima(on ¡to ¡χ2 ¡distribu(on ¡ ¡

n

MDL ¡(Minimal ¡Descrip(on ¡Length) ¡principle ¡(i.e., ¡the ¡simplest ¡solu(on ¡is ¡ preferred): ¡ ¡

n The ¡best ¡tree ¡as ¡the ¡one ¡that ¡requires ¡the ¡fewest ¡# ¡of ¡bits ¡to ¡both ¡(1) ¡

encode ¡the ¡tree, ¡and ¡(2) ¡encode ¡the ¡excep(ons ¡to ¡the ¡tree ¡

n

Mul(variate ¡splits ¡(par((on ¡based ¡on ¡mul(ple ¡variable ¡combina(ons) ¡

n CART: ¡finds ¡mul(variate ¡splits ¡based ¡on ¡a ¡linear ¡comb. ¡of ¡aNrs. ¡

n

Which ¡aNribute ¡selec(on ¡measure ¡is ¡the ¡best? ¡

n ¡Most ¡give ¡good ¡results, ¡none ¡is ¡significantly ¡superior ¡than ¡others ¡

slide-105
SLIDE 105

105

Overfitting and Tree Pruning

n Overfi{ng: ¡ ¡An ¡induced ¡tree ¡may ¡overfit ¡the ¡training ¡data ¡ ¡

n Too ¡many ¡branches, ¡some ¡may ¡reflect ¡anomalies ¡due ¡to ¡

noise ¡or ¡outliers ¡

n Poor ¡accuracy ¡for ¡unseen ¡samples ¡

n Two ¡approaches ¡to ¡avoid ¡overfi{ng ¡ ¡

n Prepruning: ¡Halt ¡tree ¡construc,on ¡early ¡̵ ¡do ¡not ¡split ¡a ¡node ¡

if ¡this ¡would ¡result ¡in ¡the ¡goodness ¡measure ¡falling ¡below ¡a ¡ threshold ¡

n Difficult ¡to ¡choose ¡an ¡appropriate ¡threshold ¡

n Postpruning: ¡Remove ¡branches ¡from ¡a ¡“fully ¡grown” ¡tree—

get ¡a ¡sequence ¡of ¡progressively ¡pruned ¡trees ¡

n Use ¡a ¡set ¡of ¡data ¡different ¡from ¡the ¡training ¡data ¡to ¡

decide ¡which ¡is ¡the ¡“best ¡pruned ¡tree” ¡

slide-106
SLIDE 106

106

Enhancements to Basic Decision Tree Induction

n Allow ¡for ¡con2nuous-­‑valued ¡adributes ¡

n Dynamically ¡define ¡new ¡discrete-­‑valued ¡aNributes ¡that ¡

par((on ¡the ¡con(nuous ¡aNribute ¡value ¡into ¡a ¡discrete ¡set ¡of ¡ intervals ¡

n Handle ¡missing ¡adribute ¡values ¡

n Assign ¡the ¡most ¡common ¡value ¡of ¡the ¡aNribute ¡ n Assign ¡probability ¡to ¡each ¡of ¡the ¡possible ¡values ¡

n Adribute ¡construc2on ¡

n Create ¡new ¡aNributes ¡based ¡on ¡exis(ng ¡ones ¡that ¡are ¡

sparsely ¡represented ¡

n This ¡reduces ¡fragmenta(on, ¡repe((on, ¡and ¡replica(on ¡

slide-107
SLIDE 107

107

Classification in Large Databases

n Classifica(on—a ¡classical ¡problem ¡extensively ¡studied ¡by ¡

sta(s(cians ¡and ¡machine ¡learning ¡researchers ¡

n Scalability: ¡Classifying ¡data ¡sets ¡with ¡millions ¡of ¡examples ¡and ¡

hundreds ¡of ¡aNributes ¡with ¡reasonable ¡speed ¡

n Why ¡is ¡decision ¡tree ¡induc(on ¡popular? ¡

n rela(vely ¡faster ¡learning ¡speed ¡(than ¡other ¡classifica(on ¡

methods) ¡

n conver(ble ¡to ¡simple ¡and ¡easy ¡to ¡understand ¡classifica(on ¡

rules ¡

n can ¡use ¡SQL ¡queries ¡for ¡accessing ¡databases ¡ n comparable ¡classifica(on ¡accuracy ¡with ¡other ¡methods ¡

n RainForest ¡(VLDB’98 ¡— ¡Gehrke, ¡Ramakrishnan ¡& ¡Gan() ¡

n Builds ¡an ¡AVC-­‑list ¡(aNribute, ¡value, ¡class ¡label) ¡

slide-108
SLIDE 108

108

Scalability Framework for RainForest

n Separates the scalability aspects from the criteria that

determine the quality of the tree

n Builds an AVC-list: AVC (Attribute, Value, Class_label) n AVC-set (of an attribute X )

n Projection of training dataset onto the attribute X and

class label where counts of individual class label are aggregated

n AVC-group (of a node n )

n Set of AVC-sets of all predictor attributes at the node n

slide-109
SLIDE 109

109

Rainforest: Training Set and Its AVC Sets

student Buy_Computer yes no yes 6 1 no 3 4 Age Buy_Computer yes no <=30 2 3 31..40 4 >40 3 2 Credit rating Buy_Computer yes no fair 6 2 excellent 3 3

age income studentcredit_rating uys_compu <=30 high no fair no <=30 high no excellent no 31…40 high no fair yes >40 medium no fair yes >40 low yes fair yes >40 low yes excellent no 31…40 low yes excellent yes <=30 medium no fair no <=30 low yes fair yes >40 medium yes fair yes <=30 medium yes excellent yes 31…40 medium no excellent yes 31…40 high yes fair yes >40 medium no excellent no

AVC-set on income AVC-set on Age AVC-set on Student

Training Examples

income Buy_Computer yes no high 2 2 medium 4 2 low 3 1

AVC-set on credit_rating

slide-110
SLIDE 110

110

BOAT (Bootstrapped Optimistic Algorithm for Tree Construction)

n Use a statistical technique called bootstrapping to create

several smaller samples (subsets), each fits in memory

n Each subset is used to create a tree, resulting in several

trees

n These trees are examined and used to construct a new

tree T’

n It turns out that T’ is very close to the tree that would

be generated using the whole data set together

n Adv: requires only two scans of DB, an incremental alg.

slide-111
SLIDE 111

April 13, 2015 Data Mining: Concepts and Techniques 111

Presentation of Classification Results

slide-112
SLIDE 112

April 13, 2015 Data Mining: Concepts and Techniques 112

Visualization of a Decision Tree in SGI/ MineSet 3.0

slide-113
SLIDE 113

Data Mining: Concepts and Techniques 113

Interactive Visual Mining by Perception-Based Classification (PBC)

slide-114
SLIDE 114

114

Issues: Evaluating Classification Methods

n Accuracy ¡

n classifier ¡accuracy: ¡predic(ng ¡class ¡label ¡ n predictor ¡accuracy: ¡guessing ¡value ¡of ¡predicted ¡aNributes ¡

n Speed ¡

n (me ¡to ¡construct ¡the ¡model ¡(training ¡(me) ¡ n (me ¡to ¡use ¡the ¡model ¡(classifica(on/predic(on ¡(me) ¡

n Robustness: ¡handling ¡noise ¡and ¡missing ¡values ¡ n Scalability: ¡efficiency ¡in ¡disk-­‑resident ¡databases ¡ ¡ n Interpretability ¡

n understanding ¡and ¡insight ¡provided ¡by ¡the ¡model ¡

n Other ¡measures, ¡e.g., ¡goodness ¡of ¡rules, ¡such ¡as ¡decision ¡tree ¡

size ¡or ¡compactness ¡of ¡classifica(on ¡rules ¡

slide-115
SLIDE 115

115

Predictor Error Measures

n

Measure ¡predictor ¡accuracy: ¡measure ¡how ¡far ¡off ¡the ¡predicted ¡value ¡is ¡from ¡ the ¡actual ¡known ¡value ¡

n

Loss ¡func2on: ¡measures ¡the ¡error ¡betw. ¡yi ¡and ¡the ¡predicted ¡value ¡yi’ ¡

n Absolute ¡error: ¡| ¡yi ¡– ¡yi’| ¡ ¡ n Squared ¡error: ¡ ¡(yi ¡– ¡yi’)2 ¡ ¡

n

Test ¡error ¡(generaliza(on ¡error): ¡the ¡average ¡loss ¡over ¡the ¡test ¡set ¡

n Mean ¡absolute ¡error: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Mean ¡squared ¡error: ¡ n Rela(ve ¡absolute ¡error: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Rela(ve ¡squared ¡error: ¡

¡ The ¡mean ¡squared-­‑error ¡exaggerates ¡the ¡presence ¡of ¡outliers ¡ Popularly ¡use ¡(square) ¡root ¡mean-­‑square ¡error, ¡similarly, ¡root ¡rela(ve ¡ squared ¡error ¡

d y y

d i i i

=

1

| ' | d y y

d i i i

=

1 2

) ' (

∑ ∑

= =

− −

d i i d i i i

y y y y

1 1

| | | ' |

∑ ∑

= =

− −

d i i d i i i

y y y y

1 2 1 2

) ( ) ' (

slide-116
SLIDE 116

116

Scalable Decision Tree Induction Methods

n SLIQ ¡(EDBT’96 ¡— ¡Mehta ¡et ¡al.) ¡

n Builds ¡an ¡index ¡for ¡each ¡aNribute ¡and ¡only ¡class ¡list ¡and ¡the ¡

current ¡aNribute ¡list ¡reside ¡in ¡memory ¡

n SPRINT ¡(VLDB’96 ¡— ¡J. ¡Shafer ¡et ¡al.) ¡

n Constructs ¡an ¡aNribute ¡list ¡data ¡structure ¡ ¡

n PUBLIC ¡(VLDB’98 ¡— ¡Rastogi ¡& ¡Shim) ¡

n Integrates ¡tree ¡spli{ng ¡and ¡tree ¡pruning: ¡stop ¡growing ¡the ¡

tree ¡earlier ¡

n RainForest ¡(VLDB’98 ¡— ¡Gehrke, ¡Ramakrishnan ¡& ¡Gan() ¡

n Builds ¡an ¡AVC-­‑list ¡(aNribute, ¡value, ¡class ¡label) ¡

n BOAT ¡(PODS’99 ¡— ¡Gehrke, ¡Gan(, ¡Ramakrishnan ¡& ¡Loh) ¡

n Uses ¡bootstrapping ¡to ¡create ¡several ¡small ¡samples ¡

slide-117
SLIDE 117

117

Data Cube-Based Decision-Tree Induction

n Integra(on ¡of ¡generaliza(on ¡with ¡decision-­‑tree ¡induc(on ¡

(Kamber ¡et ¡al.’97) ¡

n Classifica(on ¡at ¡primi(ve ¡concept ¡levels ¡

n E.g., ¡precise ¡temperature, ¡humidity, ¡outlook, ¡etc. ¡ n Low-­‑level ¡concepts, ¡scaNered ¡classes, ¡bushy ¡classifica(on-­‑

trees ¡

n Seman(c ¡interpreta(on ¡problems ¡

n Cube-­‑based ¡mul(-­‑level ¡classifica(on ¡

n Relevance ¡analysis ¡at ¡mul(-­‑levels ¡ n Informa(on-­‑gain ¡analysis ¡with ¡dimension ¡+ ¡level ¡

slide-118
SLIDE 118

118

Bayesian Classification: Why?

n A ¡sta(s(cal ¡classifier: ¡performs ¡probabilis,c ¡predic,on, ¡i.e., ¡

predicts ¡class ¡membership ¡probabili(es ¡

n Founda(on: ¡Based ¡on ¡Bayes’ ¡Theorem. ¡ ¡ n Performance: ¡A ¡simple ¡Bayesian ¡classifier, ¡naïve ¡Bayes, ¡makes ¡

strong ¡independence ¡assump(ons, ¡but ¡can ¡perform ¡well. ¡

n Comparable ¡performance ¡with ¡basic ¡decision ¡trees ¡and ¡selected ¡

neural ¡network ¡classifiers ¡

n Incremental: ¡Each ¡training ¡example ¡can ¡incrementally ¡increase/

decrease ¡the ¡probability ¡that ¡a ¡hypothesis ¡is ¡correct ¡(online ¡ learning) ¡— ¡prior ¡knowledge ¡can ¡be ¡combined ¡with ¡observed ¡data ¡

n Standard: ¡Can ¡provide ¡a ¡standard ¡of ¡op(mal ¡decision ¡making ¡

against ¡which ¡other ¡methods ¡can ¡be ¡measured ¡

slide-119
SLIDE 119

119

Bayes’ Theorem: Basics

n

Total ¡probability ¡Theorem: ¡

n

Bayes’ ¡Theorem: ¡

n Let ¡X ¡be ¡a ¡data ¡sample ¡(“evidence”): ¡class ¡label ¡is ¡unknown ¡ n Let ¡H ¡be ¡a ¡hypothesis ¡that ¡X ¡belongs ¡to ¡class ¡C ¡ ¡ n Classifica(on ¡is ¡to ¡determine ¡P(H|X), ¡(i.e., ¡posteriori ¡probability): ¡ ¡the ¡

probability ¡that ¡the ¡hypothesis ¡holds ¡given ¡the ¡observed ¡data ¡sample ¡X ¡

n P(H) ¡(prior ¡probability): ¡the ¡ini(al ¡probability ¡

n E.g., ¡X ¡will ¡buy ¡computer, ¡regardless ¡of ¡age, ¡income, ¡… ¡

n P(X): ¡probability ¡that ¡sample ¡data ¡is ¡observed ¡ n P(X|H) ¡(likelihood): ¡the ¡probability ¡of ¡observing ¡the ¡sample ¡X, ¡given ¡that ¡

the ¡hypothesis ¡holds ¡

n E.g., ¡Given ¡that ¡X ¡will ¡buy ¡computer, ¡the ¡prob. ¡that ¡X ¡is ¡31..40, ¡

medium ¡income ¡

) ( ) 1 | ( ) ( i A P M i i A B P B P

= =

) ( / ) ( ) | ( ) ( ) ( ) | ( ) | ( X X X X X P H P H P P H P H P H P × = =

slide-120
SLIDE 120

120

Prediction Based on Bayes’ Theorem

n Given ¡training ¡data ¡X, ¡posteriori ¡probability ¡of ¡a ¡hypothesis ¡H, ¡

P(H|X), ¡follows ¡the ¡Bayes’ ¡theorem ¡ ¡ ¡ ¡ ¡

n Informally, ¡this ¡can ¡be ¡viewed ¡as ¡ ¡

¡ ¡posteriori ¡= ¡likelihood ¡x ¡prior/evidence ¡

n Predicts ¡X ¡belongs ¡to ¡Ci ¡iff ¡the ¡probability ¡P(Ci|X) ¡is ¡the ¡highest ¡

among ¡all ¡the ¡P(Ck|X) ¡for ¡all ¡the ¡k ¡classes ¡

n Prac(cal ¡difficulty: ¡ ¡It ¡requires ¡ini(al ¡knowledge ¡of ¡many ¡

probabili(es, ¡which ¡may ¡involve ¡significant ¡computa(onal ¡cost ¡

) ( / ) ( ) | ( ) ( ) ( ) | ( ) | ( X X X X X P H P H P P H P H P H P × = =

slide-121
SLIDE 121

121

Classification Is to Derive the Maximum Posteriori

n Let ¡D ¡be ¡a ¡training ¡set ¡of ¡tuples ¡and ¡their ¡associated ¡class ¡

labels, ¡and ¡each ¡tuple ¡is ¡represented ¡by ¡an ¡n-­‑D ¡aNribute ¡vector ¡ X ¡= ¡(x1, ¡x2, ¡…, ¡xn) ¡

n Suppose ¡there ¡are ¡m ¡classes ¡C1, ¡C2, ¡…, ¡Cm. ¡ n Classifica(on ¡is ¡to ¡derive ¡the ¡maximum ¡posteriori, ¡i.e., ¡the ¡

maximal ¡P(Ci|X) ¡

n This ¡can ¡be ¡derived ¡from ¡Bayes’ ¡theorem ¡ n Since ¡P(X) ¡is ¡constant ¡for ¡all ¡classes, ¡only ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

needs ¡to ¡be ¡maximized ¡

) ( ) ( ) | ( ) | ( X X X P i C P i C P i C P =

) ( ) | ( ) | ( i C P i C P i C P X X =

slide-122
SLIDE 122

122

Naïve Bayes Classifier

n A ¡simplified ¡assump(on: ¡aNributes ¡are ¡condi(onally ¡

independent ¡(i.e., ¡no ¡dependence ¡rela(on ¡between ¡aNributes): ¡

n This ¡greatly ¡reduces ¡the ¡computa(on ¡cost: ¡Only ¡counts ¡the ¡

class ¡distribu(on ¡

n If ¡Ak ¡is ¡categorical, ¡P(xk|Ci) ¡is ¡the ¡# ¡of ¡tuples ¡in ¡Ci ¡having ¡value ¡xk ¡

for ¡Ak ¡divided ¡by ¡|Ci, ¡D| ¡(# ¡of ¡tuples ¡of ¡Ci ¡in ¡D) ¡

n If ¡Ak ¡is ¡con(nous-­‑valued, ¡P(xk|Ci) ¡is ¡usually ¡computed ¡based ¡on ¡

Gaussian ¡distribu(on ¡with ¡a ¡mean ¡μ ¡and ¡standard ¡devia(on ¡σ ¡ and ¡P(xk|Ci) ¡is ¡ ¡

) | ( ... ) | ( ) | ( 1 ) | ( ) | (

2 1

Ci x P Ci x P Ci x P n k Ci x P Ci P

n k

× × × = ∏ = = X

2 2

2 ) (

2 1 ) , , (

σ µ

σ π σ µ

− −

=

x

e x g

) , , ( ) | (

i i

C C k

x g Ci P σ µ = X

slide-123
SLIDE 123

123

Naïve Bayes Classifier: Training Dataset

Class: ¡ C1:buys_computer ¡= ¡ ‘yes’ ¡ C2:buys_computer ¡= ¡ ‘no’ ¡ ¡ Data ¡to ¡be ¡classified: ¡ ¡ X ¡= ¡(age ¡<=30, ¡ ¡ Income ¡= ¡medium, ¡ Student ¡= ¡yes ¡ Credit_ra(ng ¡= ¡Fair) ¡

age income student credit_rating uys_compu <=30 high no fair no <=30 high no excellent no 31…40 high no fair yes >40 medium no fair yes >40 low yes fair yes >40 low yes excellent no 31…40 low yes excellent yes <=30 medium no fair no <=30 low yes fair yes >40 medium yes fair yes <=30 medium yes excellent yes 31…40 medium no excellent yes 31…40 high yes fair yes >40 medium no excellent no

slide-124
SLIDE 124

124

Naïve Bayes Classifier: An Example

n

P(Ci): ¡ ¡ ¡ ¡P(buys_computer ¡= ¡“yes”) ¡ ¡= ¡9/14 ¡= ¡0.643 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡P(buys_computer ¡= ¡“no”) ¡= ¡5/14= ¡0.357 ¡

n

Compute ¡P(X|Ci) ¡for ¡each ¡class ¡ ¡ ¡ ¡ ¡ ¡P(age ¡= ¡“<=30” ¡| ¡buys_computer ¡= ¡“yes”) ¡ ¡= ¡2/9 ¡= ¡0.222 ¡ ¡ ¡ ¡ ¡ ¡P(age ¡= ¡“<= ¡30” ¡| ¡buys_computer ¡= ¡“no”) ¡= ¡3/5 ¡= ¡0.6 ¡ ¡ ¡ ¡ ¡ ¡P(income ¡= ¡“medium” ¡| ¡buys_computer ¡= ¡“yes”) ¡= ¡4/9 ¡= ¡0.444 ¡ ¡ ¡ ¡ ¡ ¡P(income ¡= ¡“medium” ¡| ¡buys_computer ¡= ¡“no”) ¡= ¡2/5 ¡= ¡0.4 ¡ ¡ ¡ ¡ ¡ ¡P(student ¡= ¡“yes” ¡| ¡buys_computer ¡= ¡“yes) ¡= ¡6/9 ¡= ¡0.667 ¡ ¡ ¡ ¡ ¡ ¡P(student ¡= ¡“yes” ¡| ¡buys_computer ¡= ¡“no”) ¡= ¡1/5 ¡= ¡0.2 ¡ ¡ ¡ ¡ ¡ ¡P(credit_ra(ng ¡= ¡“fair” ¡| ¡buys_computer ¡= ¡“yes”) ¡= ¡6/9 ¡= ¡0.667 ¡ ¡ ¡ ¡ ¡ ¡P(credit_ra(ng ¡= ¡“fair” ¡| ¡buys_computer ¡= ¡“no”) ¡= ¡2/5 ¡= ¡0.4 ¡

n

¡X ¡= ¡(age ¡<= ¡30 ¡, ¡income ¡= ¡medium, ¡student ¡= ¡yes, ¡credit_ra2ng ¡= ¡fair) ¡ ¡P(X|Ci) ¡: ¡P(X|buys_computer ¡= ¡“yes”) ¡= ¡0.222 ¡x ¡0.444 ¡x ¡0.667 ¡x ¡0.667 ¡= ¡0.044 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡P(X|buys_computer ¡= ¡“no”) ¡= ¡0.6 ¡x ¡0.4 ¡x ¡0.2 ¡x ¡0.4 ¡= ¡0.019 ¡ P(X|Ci)*P(Ci) ¡: ¡P(X|buys_computer ¡= ¡“yes”) ¡* ¡P(buys_computer ¡= ¡“yes”) ¡= ¡0.028 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡P(X|buys_computer ¡= ¡“no”) ¡* ¡P(buys_computer ¡= ¡“no”) ¡= ¡0.007 ¡ Therefore, ¡ ¡X ¡belongs ¡to ¡class ¡(“buys_computer ¡= ¡yes”) ¡

¡ ¡

age income student credit_rating uys_compu <=30 high no fair no <=30 high no excellent no 31…40 high no fair yes >40 medium no fair yes >40 low yes fair yes >40 low yes excellent no 31…40 low yes excellent yes <=30 medium no fair no <=30 low yes fair yes >40 medium yes fair yes <=30 medium yes excellent yes 31…40 medium no excellent yes 31…40 high yes fair yes >40 medium no excellent no

slide-125
SLIDE 125

125

Avoiding the Zero-Probability Problem

n Naïve ¡Bayesian ¡predic(on ¡requires ¡each ¡condi(onal ¡prob. ¡be ¡

non-­‑zero. ¡ ¡Otherwise, ¡the ¡predicted ¡prob. ¡will ¡be ¡zero ¡ ¡ ¡

n Ex. ¡Suppose ¡a ¡dataset ¡with ¡1000 ¡tuples, ¡income=low ¡(0), ¡

income= ¡medium ¡(990), ¡and ¡income ¡= ¡high ¡(10) ¡

n Use ¡Laplacian ¡correc2on ¡(or ¡Laplacian ¡es(mator) ¡

n Adding ¡1 ¡to ¡each ¡case ¡

Prob(income ¡= ¡low) ¡= ¡1/1003 ¡ Prob(income ¡= ¡medium) ¡= ¡991/1003 ¡ Prob(income ¡= ¡high) ¡= ¡11/1003 ¡

n The ¡“corrected” ¡prob. ¡es(mates ¡are ¡close ¡to ¡their ¡

“uncorrected” ¡counterparts ¡ ∏ = = n k Ci xk P Ci X P 1 ) | ( ) | (

slide-126
SLIDE 126

126

Naïve Bayes Classifier: Comments

n Advantages ¡ ¡

n Easy ¡to ¡implement ¡ ¡ n Good ¡results ¡obtained ¡in ¡most ¡of ¡the ¡cases ¡

n Disadvantages ¡

n Assump(on: ¡class ¡condi(onal ¡independence, ¡therefore ¡loss ¡of ¡

accuracy ¡

n Prac(cally, ¡dependencies ¡exist ¡among ¡variables ¡ ¡

n E.g., ¡ ¡hospitals: ¡pa(ents: ¡Profile: ¡age, ¡family ¡history, ¡etc. ¡ ¡

¡Symptoms: ¡fever, ¡cough ¡etc., ¡Disease: ¡lung ¡cancer, ¡

diabetes, ¡etc. ¡ ¡

n Dependencies ¡among ¡these ¡cannot ¡be ¡modeled ¡by ¡Naïve ¡

Bayes ¡Classifier ¡

n How ¡to ¡deal ¡with ¡these ¡dependencies? ¡Bayesian ¡Belief ¡Networks ¡

(Chapter ¡9) ¡