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
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:
1
1
Jay Urbain, PhD
Credits: Tom Mitchell, Machine Learning, CMU Nazli Goharian, IIT/Georgetown Jiawei Han, Micheline Kamber, and Jian Pei, Data Mining
2
3 ¡
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 ¡
4
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 ¡
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 ¡
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 ¡
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 ¡
6
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 ¡
7
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)
8
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?
9 ¡
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 ¡
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.
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.
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.
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)
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)
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
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
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
So, expected number of bits to encode + or – examples of random member
Gain(S,A) = expected reduction in entropy due to sorting of A
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
n
Aim: find a small tree consistent with the training examples
n
Idea: (recursively) choose "most significant" attribute as root of (sub)tree
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”
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.
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?
Consider adding noisy training example D15:
n Sunny, Hot, Normal, Strong, Play tennis=No
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:
Avoid Overfitting:
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))
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
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
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
39
40 ¡
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 ¡
41
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 ¡
April 13, 2015 42
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
April 13, 2015 43
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)
April 13, 2015 44
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
April 13, 2015 45
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
regardless of data.
a fruit bin without knowledge of shape and color.
April 13, 2015 46
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.
April 13, 2015 47
April 13, 2015 48
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.
April 13, 2015 49
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
April 13, 2015 50
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)
April 13, 2015 51
An incoming sample: X = <sunny, cool, high, true>
April 13, 2015 52
April 13, 2015 53
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.
54
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 ) | ( ) | (
55
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 ))
56
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 ¡
57 ¡
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 ¡
58
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 ¡
59
age? student? credit rating?
<=30 >40
no yes yes yes
31..40
n
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 ¡
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 ¡
60
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 ¡
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 ¡
61
¡ ¡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
62
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
63
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
64 ¡
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 ¡
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 ¡
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 ¡
n Classifier ¡Accuracy: ¡percentage ¡
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 ¡
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 ¡
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) ¡
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 ¡
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
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 ¡
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 ¡
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 ¡
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 ¡
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
¡
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 ¡
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 ¡
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 ¡
77 ¡
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 ¡
79 ¡
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 ¡
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 ¡
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 ¡
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
83 ¡
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
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 ¡
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 ¡
86 ¡
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 ¡
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 ¡
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 ¡
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-‑
method ¡
88 ¡
n
Genera(on ¡Computer ¡Systems, ¡13, ¡1997 ¡
n
1995 ¡
n
Wadsworth ¡Interna(onal ¡Group, ¡1984 ¡
n
Mining ¡and ¡Knowledge ¡Discovery, ¡2(2): ¡121-‑168, ¡1998 ¡
n
for ¡scaling ¡machine ¡learning. ¡KDD'95 ¡
n
Discrimina2ve ¡Frequent ¡Padern ¡Analysis ¡for ¡Effec2ve ¡Classifica2on, ¡ICDE'07 ¡
n
Direct ¡Discrimina2ve ¡Padern ¡Mining ¡for ¡Effec2ve ¡Classifica2on, ¡ICDE'08 ¡
n
n
gene ¡expression ¡data. ¡ ¡SIGMOD'05 ¡
89 ¡
n
n
n
n
n
an ¡ ¡applica2on ¡to ¡boos2ng. ¡J. ¡Computer ¡and ¡System ¡Sciences, ¡1997. ¡
n
construc2on ¡of ¡large ¡datasets. ¡VLDB’98. ¡
n
n
Mining, ¡Inference, ¡ ¡and ¡Predic2on. ¡Springer-‑Verlag, ¡2001. ¡
n
combina2on ¡of ¡knowledge ¡and ¡sta2s2cal ¡data. ¡Machine ¡Learning, ¡1995. ¡
n
Class-‑Associa2on ¡Rules, ¡ICDM'01. ¡ ¡
90 ¡
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
automa2c ¡interac2on ¡detec2on. ¡In ¡R. ¡P. ¡Bagozzi, ¡editor, ¡Advanced ¡Methods ¡of ¡ Marke(ng ¡Research, ¡Blackwell ¡Business, ¡1994. ¡
n
n
n
Disciplinary ¡Survey, ¡Data ¡Mining ¡and ¡Knowledge ¡Discovery ¡2(4): ¡345-‑389, ¡1998 ¡
n
n
n
n
91 ¡
n
n
n
n
n
Predic2on ¡Methods ¡from ¡Sta2s2cs, ¡Neural ¡Nets, ¡Machine ¡Learning, ¡and ¡Expert ¡
n
n
Techniques, ¡ ¡2ed. ¡ ¡Morgan ¡Kaufmann, ¡2005. ¡
n
n
92 ¡
94
age?
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: ¡
95
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 ¡
n
96
m = 2
97
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 × = ∑
=
A
98
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
99
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 ¡
100
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
× − = ∑
=
101
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 + =
A
102
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
⎟ ⎠ ⎞ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ =
∈
103
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 ¡
104
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 ¡
105
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” ¡
106
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 ¡
107
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) ¡
108
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
109
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
110
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.
April 13, 2015 Data Mining: Concepts and Techniques 111
April 13, 2015 Data Mining: Concepts and Techniques 112
Data Mining: Concepts and Techniques 113
114
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 ¡
115
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
) ( ) ' (
116
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 ¡
117
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 ¡
118
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 ¡
119
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 × = =
120
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 × = =
121
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 =
122
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
123
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
124
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
125
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 ) | ( ) | (
126
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) ¡