Download Data Mining Classification: Rule-Based Classifiers, Bayesian

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Nonlinear dimensionality reduction wikipedia , lookup

Transcript
Data Mining
Classification: Rule-Based Classifiers,
Bayesian Classifiers, and SVM
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
1
Rule-Based Classifier
  Classify
records by using a collection of “if…
then…” rules
  Rule:
– 
– 
– 
– 
(Condition) → y
where y is the class label
LHS: rule antecedent or condition
RHS: rule consequent
Examples of classification rules:
u  (Blood
© Tan,Steinbach, Kumar
Type=Warm) ∧ (Lay Eggs=Yes) → Birds
Introduction to Data Mining
4/18/2004
‹#›
Rule-based Classifier (Example)
Name
Blood Type
human
python
salmon
whale
frog
komodo
bat
pigeon
cat
leopard shark
turtle
penguin
porcupine
eel
salamander
gila monster
platypus
owl
dolphin
eagle
warm
cold
cold
warm
cold
cold
warm
warm
warm
cold
cold
warm
warm
cold
cold
cold
warm
warm
warm
warm
Give Birth
yes
no
no
yes
no
no
yes
no
yes
yes
no
no
yes
no
no
no
no
no
yes
no
Can Fly
no
no
no
no
no
no
yes
yes
no
no
no
no
no
no
no
no
no
yes
no
yes
Live in Water
no
no
yes
yes
sometimes
no
no
no
no
yes
sometimes
sometimes
no
yes
sometimes
no
no
no
yes
no
Class
mammals
reptiles
fishes
mammals
amphibians
reptiles
mammals
birds
mammals
fishes
reptiles
birds
mammals
fishes
amphibians
reptiles
mammals
birds
mammals
birds
R1: (Give Birth = no) ∧ (Can Fly = yes) → Birds
R2: (Give Birth = no) ∧ (Live in Water = yes) → Fishes
R3: (Give Birth = yes) ∧ (Blood Type = warm) → Mammals
R4: (Give Birth = no) ∧ (Can Fly = no) → Reptiles
R5: (Live in Water = sometimes) → Amphibians
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Application of Rule-Based Classifier
  A
rule r covers an instance x if the attributes of
the instance satisfy the condition of the rule
R1: (Give Birth = no) ∧ (Can Fly = yes) → Birds
R2: (Give Birth = no) ∧ (Live in Water = yes) → Fishes
R3: (Give Birth = yes) ∧ (Blood Type = warm) → Mammals
R4: (Give Birth = no) ∧ (Can Fly = no) → Reptiles
R5: (Live in Water = sometimes) → Amphibians
Name
hawk
grizzly bear
Blood Type
warm
warm
Give Birth
Can Fly
Live in Water
Class
no
yes
yes
no
no
no
?
?
The rule R1 covers a hawk => hawk is Bird
The rule R3 covers a bear => bear is Mammal
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Rule Coverage and Accuracy
Tid Refund Marital
  Coverage
of a rule:
Status
1
Yes
Single
–  Fraction of records
2
No
Married
that satisfy the
3
No
Single
antecedent of a rule
4
Yes
Married
5
No
Divorced
  Accuracy of a rule:
6
No
Married
–  Fraction of records
7
Yes
Divorced
that satisfy both the
8
No
Single
9
No
Married
antecedent and
10 No
Single
consequent of a
(Status=Single) → No
rule
Taxable
Income Class
125K
No
100K
No
70K
No
120K
No
95K
Yes
60K
No
220K
No
85K
Yes
75K
No
90K
Yes
10
Coverage = 40%, Accuracy = 50%
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
How does Rule-based Classifier Work?
R1: (Give Birth = no) ∧ (Can Fly = yes) → Birds
R2: (Give Birth = no) ∧ (Live in Water = yes) → Fishes
R3: (Give Birth = yes) ∧ (Blood Type = warm) → Mammals
R4: (Give Birth = no) ∧ (Can Fly = no) → Reptiles
R5: (Live in Water = sometimes) → Amphibians
Name
lemur
turtle
dogfish shark
Blood Type
warm
cold
cold
Give Birth
Can Fly
Live in Water
Class
yes
no
yes
no
no
no
no
sometimes
yes
?
?
?
A lemur triggers rule R3, so it is classified as a mammal
A turtle triggers both R4 and R5
A dogfish shark triggers none of the rules
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Characteristics of Rule-Based Classifier
  Mutually
exclusive rules
–  Classifier contains mutually exclusive rules if
the rules are independent of each other
–  Every record is covered by at most one rule
  Exhaustive
rules
–  Classifier has exhaustive coverage if it
accounts for every possible combination of
attribute values
–  Each record is covered by at least one rule
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Effect of Rule Simplification
  Rules
are no longer mutually exclusive
–  A record may trigger more than one rule
–  Solution?
u  Ordered
rule set
u  Unordered rule set – use voting schemes
  Rules
are no longer exhaustive
–  A record may not trigger any rules
–  Solution?
u  Use
© Tan,Steinbach, Kumar
a default class
Introduction to Data Mining
4/18/2004
‹#›
Ordered Rule Set
  Rules are rank ordered according to
–  An ordered rule set is known as a decision list
their priority
  When a test record is presented to the classifier
–  It is assigned to the class label of the highest ranked rule it has
triggered
–  If none of the rules fired, it is assigned to the default class
R1: (Give Birth = no) ∧ (Can Fly = yes) → Birds
R2: (Give Birth = no) ∧ (Live in Water = yes) → Fishes
R3: (Give Birth = yes) ∧ (Blood Type = warm) → Mammals
R4: (Give Birth = no) ∧ (Can Fly = no) → Reptiles
R5: (Live in Water = sometimes) → Amphibians
Name
turtle
Blood Type
Give Birth
Can Fly
Live in Water
Class
no
no
sometimes
?
cold
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Rule Ordering Schemes
  Rule-based ordering
–  Individual rules are ranked based on their quality
  Class-based ordering
–  Rules that belong to the same class appear together
Rule-based Ordering
Class-based Ordering
(Refund=Yes) ==> No
(Refund=Yes) ==> No
(Refund=No, Marital Status={Single,Divorced},
Taxable Income<80K) ==> No
(Refund=No, Marital Status={Single,Divorced},
Taxable Income<80K) ==> No
(Refund=No, Marital Status={Single,Divorced},
Taxable Income>80K) ==> Yes
(Refund=No, Marital Status={Married}) ==> No
(Refund=No, Marital Status={Married}) ==> No
© Tan,Steinbach, Kumar
(Refund=No, Marital Status={Single,Divorced},
Taxable Income>80K) ==> Yes
Introduction to Data Mining
4/18/2004
‹#›
Building Classification Rules
  Direct
Method:
u  Extract
rules directly from data
u  e.g. RIPPER
  Indirect
Method:
u  Extract
rules from other classification models (e.g.
decision trees, neural networks, etc.)
u  e.g. C4.5rules
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Direct Method: Sequential Covering
1. 
2. 
3. 
4. 
Start from an empty rule
Grow a rule using the Learn-One-Rule function
Remove training records covered by the rule
Repeat Step (2) and (3) until stopping criterion
is met
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Example of Sequential Covering
(i) Original Data
© Tan,Steinbach, Kumar
(ii) Step 1
Introduction to Data Mining
4/18/2004
‹#›
Example of Sequential Covering…
R1
R1
R2
(iii) Step 2
© Tan,Steinbach, Kumar
(iv) Step 3
Introduction to Data Mining
4/18/2004
‹#›
Aspects of Sequential Covering
  Rule
Growing
  Instance
  Rule
Elimination
Evaluation
  Stopping
  Rule
Criterion
Pruning
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Rule Growing
 
Two common strategies
{}
Yes: 3
No: 4
Refund=No,
Status=Single,
Income=85K
(Class=Yes)
Refund=
No
Status =
Single
Status =
Divorced
Status =
Married
Yes: 3
No: 4
Yes: 2
No: 1
Yes: 1
No: 0
Yes: 0
No: 3
...
Income
> 80K
Yes: 3
No: 1
(a) General-to-specific
© Tan,Steinbach, Kumar
Introduction to Data Mining
Refund=No,
Status=Single,
Income=90K
(Class=Yes)
Refund=No,
Status = Single
(Class = Yes)
(b) Specific-to-general
4/18/2004
‹#›
Rule Growing (Examples)
 
RIPPER Algorithm:
–  Start from an empty rule: {} => class
–  Add conjuncts that maximizes FOIL’s information gain measure:
u  R0:
{} => class (initial rule)
{A} => class (rule after adding conjunct)
u  Gain(R0, R1) = p1 [ log (p1/(p1+n1)) – log (p0/(p0 + n0)) ]
u  where p0: number of positive instances covered by R0
n0: number of negative instances covered by R0
p1: number of positive instances covered by R1
n1: number of negative instances covered by R1
u  R1:
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Instance Elimination
 
Why do we need to
eliminate instances?
–  Otherwise, the next rule is
identical to previous rule
–  Remove positive instances
to ensure that the next rule
is different
–  Remove negative
instances to prevent
underestimating accuracy
of rule
© Tan,Steinbach, Kumar
R3
R1
+
class = +
+
-
class = -
Introduction to Data Mining
+
-
+
+
+
+ +
+
-
-
+
+
+
-
-
+ +
+
+
+
++
+
+
+++
+ + +
+ +
-
-
R2
-
-
-
-
-
-
4/18/2004
‹#›
Rule Evaluation
  Metrics:
f+
n
f+ +1
–  Laplace =
n+k
–  Accuracy
=
f + + kp+
–  M-estimate =
n+k
n : Number of instances
covered by rule
f+ : Number of positive
instances covered by rule
k : Number of classes
p+ : Prior probability for
positive class
p1 : Number of positive
–  FOIL’s information gain
instances covered by new rule
p1
p0
= p1(log 2
− log 2
) n1 : Number of negative
p1 + n1
p 0 + n 0 instances covered by new rule
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Rule Evaluation Example
 
Consider a training set that contains 60 positive examples
and 100 negative examples.
Rule r1 covers 50 positive examples and 5 negative
examples
Rule r2 covers 2 positive examples and no negative
examples
Accuracy of r1=50/55=90.9%, accuracy of r2=2/2=100%
Laplace measure for r1=(50+1)/(55+2)=89.47%,
r2=(2+1)/(2+2)=75%
Foil’s information gain for r1=63.87, r2=2.83 (textbook’s
numbers are wrong)
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Stopping Criterion and Rule Pruning
  Stopping
criterion
–  Compute the gain
–  If gain is not significant, discard the new rule
  Rule
Pruning
–  Similar to post-pruning of decision trees
–  Reduced Error Pruning:
u  Remove
one of the conjuncts in the rule
u  Compare error rate on validation set before and
after pruning
u  If error improves, prune the conjunct
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Indirect Methods
P
No
Yes
Q
No
-
Rule Set
R
Yes
No
Yes
+
+
Q
No
-
© Tan,Steinbach, Kumar
Yes
r1: (P=No,Q=No) ==> r2: (P=No,Q=Yes) ==> +
r3: (P=Yes,R=No) ==> +
r4: (P=Yes,R=Yes,Q=No) ==> r5: (P=Yes,R=Yes,Q=Yes) ==> +
+
Introduction to Data Mining
4/18/2004
‹#›
Indirect Method: C4.5rules
  Extract
rules from an unpruned decision tree
  For each rule, r: A → y,
–  consider an alternative rule r’: A’ → y where
A’ is obtained by removing one of the
conjuncts in A
–  Compare the pessimistic error rate for r
against all r’s
–  Prune if one of the r’s has lower pessimistic
error rate
–  Repeat until we can no longer improve
generalization error
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Indirect Method: C4.5rules
  Instead
of ordering the rules, order subsets of
rules (class ordering)
–  Each subset is a collection of rules with the
same rule consequent (class)
–  Compute description length of each subset
u  Description
length = L(error) + g L(model)
u  g is a parameter that takes into account the
presence of redundant attributes in a rule set
(default value = 0.5)
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Advantages of Rule-Based Classifiers
  As
highly expressive as decision trees
  Easy to interpret
  Easy to generate
  Can classify new instances rapidly
  Performance comparable to decision trees
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Bayes Classifier
  A
probabilistic framework for solving classification
problems
  Conditional Probability:
P( A, C )
P(C | A) =
P( A)
P( A | C ) =
 
P( A, C )
P(C )
Bayes theorem:
P(C | A) =
© Tan,Steinbach, Kumar
P( A | C ) P(C )
P( A)
Introduction to Data Mining
4/18/2004
‹#›
Example of Bayes Theorem
  Given:
–  A doctor knows that heart disease causes stiff neck 50% of
the time
–  Prior probability of any patient having heart disease is
1/50,000
–  Prior probability of any patient having stiff neck is 1/20
 
If a patient has stiff neck, what’s the probability
he/she has heart disease?
P( H | S ) =
© Tan,Steinbach, Kumar
P( S | H ) P( H ) 0.5 × (1 / 50000)
=
= 0.0002
P( S )
1 / 20
Introduction to Data Mining
4/18/2004
‹#›
Bayesian Classifiers
  Consider
each attribute and class label as random
variables
  Given
a record with attributes (A1, A2,…,An)
–  Goal is to predict class C
–  Specifically, we want to find the value of C that
maximizes P(C| A1, A2,…,An )
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Bayesian Classifiers
 
Approach:
–  compute the posterior probability P(C | A1, A2, …, An) for
all values of C using the Bayes theorem
P(C | A A … A ) =
1
2
n
P( A A … A | C ) P(C )
P( A A … A )
1
2
n
1
2
n
–  Choose value of C that maximizes
P(C | A1, A2, …, An)
–  Equivalent to choosing value of C that maximizes
P(A1, A2, …, An|C) P(C)
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Naïve Bayes Classifier
 
Assume independence among attributes Ai when class is
given:
–  P(A1, A2, …, An |C) = P(A1| Cj) P(A2| Cj)… P(An| Cj)
–  Can estimate P(Ai| Cj) for all Ai and Cj from training
data
–  New data point is classified to Cj if P(Cj) Π P(Ai| Cj) is
maximal
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
How to Estimate
Probabilities from Data?
l
l
ca
te
r
go
a
ic
ca
te
r
go
a
ic
co
n
u
tin
ou
s
s
a s   Class:
cl
Tid
Refund
Home
Owner
Marital
Status
Taxable Defaulted
Evade
Income Borrower
1
Yes
Single
125K
No
2
No
Married
100K
No
3
No
Single
70K
No
4
Yes
Married
120K
No
5
No
Divorced
95K
Yes
6
No
Married
60K
No
7
Yes
Divorced
220K
No
8
No
Single
85K
Yes
9
No
Married
75K
No
10
No
Single
90K
Yes
  For
discrete attributes:
P(Ai | Ck) = |Aik|/ Nc k
–  where |Aik| is number of
instances having attribute
Ai and belongs to class Ck
–  Examples:
10
© Tan,Steinbach, Kumar
P(C) = Nc/N
–  e.g., P(No) = 7/10,
P(Yes) = 3/10
P(Status=Married|No) = 4/7
P(HomeOwner=Yes|Yes)=0
Introduction to Data Mining
4/18/2004
‹#›
How to Estimate Probabilities from Data?
  For
continuous attributes:
–  Discretize the range into bins
u  one
ordinal attribute per bin
u  violates independence assumption
–  Two-way split: (A < v) or (A > v)
u  choose
only one of the two splits as new attribute
–  Probability density estimation:
u  Assume
attribute follows a normal distribution
u  Use data to estimate parameters of distribution
(e.g., mean and standard deviation)
u  Once probability distribution is known, can use it to
estimate the conditional probability P(Ai|C)
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
How to Estimate Probabilities from Data?
 
Normal distribution:
P( Ai | c j ) =
1
2πσ ij2
e
−
( Ai − µij ) 2
2σ ij2
–  One for each (Ai,ci) pair
e.g. for (Income, Class=No)
u  sample mean µ = 110
u  sample variance σ2 = 2975
1
P( Income = 120 | No) =
e
2π (54.54)
© Tan,Steinbach, Kumar
Introduction to Data Mining
−
( 120 −110 ) 2
2 ( 2975 )
= 0.0072
4/18/2004
‹#›
Example of Naïve Bayes Classifier
Given a Test Record:
X = (HomeOwner = No, Married, Income = 120K)
 
P(X|Class=No) = P(HomeOwner=No|Class=No)
× P(Married| Class=No)
× P(Income=120K| Class=No)
= 4/7 × 4/7 × 0.0072 = 0.0024
 
P(X|Class=Yes) = P(HomeOwner=No| Class=Yes)
× P(Married| Class=Yes)
× P(Income=120K| Class=Yes)
= 1 × 0 × 1.2 × 10-9 = 0
Since P(X|No)P(No) > P(X|Yes)P(Yes)
Therefore P(No|X) > P(Yes|X)
=> Class = No
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Naïve Bayes Classifier
  If
one of the conditional probability is zero, then
the entire expression becomes zero
  Probability estimation:
Original : P ( Ai | C ) =
N ic
Nc
c: number of classes
N +1
Laplace : P ( Ai | C ) = ic
Nc + c
p: prior probability
N + mp
m - estimate : P ( Ai | C ) = ic
Nc + m
© Tan,Steinbach, Kumar
m: parameter
Introduction to Data Mining
4/18/2004
‹#›
Example of Naïve Bayes Classifier
Name
human
python
salmon
whale
frog
komodo
bat
pigeon
cat
leopard shark
turtle
penguin
porcupine
eel
salamander
gila monster
platypus
owl
dolphin
eagle
Give Birth
yes
Give Birth
yes
no
no
yes
no
no
yes
no
yes
yes
no
no
yes
no
no
no
no
no
yes
no
Can Fly
no
no
no
no
no
no
yes
yes
no
no
no
no
no
no
no
no
no
yes
no
yes
Can Fly
no
© Tan,Steinbach, Kumar
Live in Water Have Legs
no
no
yes
yes
sometimes
no
no
no
no
yes
sometimes
sometimes
no
yes
sometimes
no
no
no
yes
no
Class
yes
no
no
no
yes
yes
yes
yes
yes
no
yes
yes
yes
no
yes
yes
yes
yes
no
yes
mammals
non-mammals
non-mammals
mammals
non-mammals
non-mammals
mammals
non-mammals
mammals
non-mammals
non-mammals
non-mammals
mammals
non-mammals
non-mammals
non-mammals
mammals
non-mammals
mammals
non-mammals
Live in Water Have Legs
yes
no
Class
?
Introduction to Data Mining
A: attributes
M: mammals
N: non-mammals
6 6 2 2
P ( A | M ) = × × × = 0.06
7 7 7 7
1 10 3 4
P ( A | N ) = × × × = 0.0042
13 13 13 13
7
P ( A | M ) P ( M ) = 0.06 × = 0.021
20
13
P ( A | N ) P ( N ) = 0.004 × = 0.0027
20
P(A|M)P(M) > P(A|N)P(N)
=> Mammals
4/18/2004
‹#›
Support Vector Machines
 
Find a linear hyperplane (decision boundary) that will separate the data
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
4/18/2004
‹#›
Support Vector Machines
B1
B2
 
 
Which one is better? B1 or B2?
How do you define better?
© Tan,Steinbach, Kumar
Introduction to Data Mining
Support Vector Machines
B1
B2
b21
b22
margin
b11
b12
 
Find hyperplane maximizes the margin => B1 is better than B2
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Support Vector Machines
B1
 
w• x + b = 0
 
w • x + b = +1
 
w • x + b = −1
b11
 
if w • x + b ≥ 1
⎧ 1

f ( x ) = ⎨
 
⎩− 1 if w • x + b ≤ −1
© Tan,Steinbach, Kumar
Introduction to Data Mining
b12
2
Margin =  2
|| w ||
4/18/2004
‹#›
Support Vector Machines
  We
want to maximize:
2
Margin =  2
|| w ||

|| w ||2
–  Which is equivalent to minimizing: L( w) =
2
–  But subjected to the following constraints:
 
if w • x i + b ≥ 1
⎧ 1

f ( xi ) = ⎨
 
⎩− 1 if w • x i + b ≤ −1
u  This
is a constrained optimization problem
–  Numerical approaches to solve it (e.g., quadratic programming)
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Support Vector Machines
  What
if the problem is not linearly separable?
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Support Vector Machines
  Introduce
slack variables ξ
–  Need to minimize:

|| w || 2
⎛ N
⎞
L( w) =
+ C ⎜ ∑ ξ ik ⎟
2
⎝ i =1 ⎠
–  Subject to:
 
if w • x i + b ≥ 1 - ξi
⎧ 1

f ( xi ) = ⎨
 
⎩− 1 if w • x i + b ≤ −1 + ξi
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Nonlinear Support Vector Machines
  What
if decision boundary is not linear?
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Nonlinear Support Vector Machines
  Transform
© Tan,Steinbach, Kumar
data into higher dimensional space
Introduction to Data Mining
4/18/2004
‹#›
Ensemble Methods
  Construct
a set of classifiers from the training
data set
  Predict
class label of previously unseen records
by aggregating predictions made by multiple
classifiers
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
General Idea
D
Step 1:
Create Multiple
Data Sets
Step 2:
Build Multiple
Classifiers
D1
D2
C1
C2
....
Step 3:
Combine
Classifiers
Original
Training data
Dt-1
Dt
Ct -1
Ct
C*
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Why does it work?
  Suppose
there are 25 base classifiers
–  Each classifier has error rate, ε = 0.35
–  Assume classifiers are independent
–  Probability that the ensemble classifier makes
a wrong prediction:
25
⎛ 25 ⎞
i
∑ ⎜⎜ i ⎟⎟ε (1 − ε )
i =13
© Tan,Steinbach, Kumar
⎝
25−i
= 0.06
⎠
Introduction to Data Mining
4/18/2004
‹#›
Examples of Ensemble Methods
  How
to generate an ensemble of classifiers?
–  Bagging
–  Boosting
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Bagging
  Sampling
Original Data
Bagging (Round 1)
Bagging (Round 2)
Bagging (Round 3)
  Build
with replacement
1
7
1
1
2
8
4
8
3
10
9
5
4
8
1
10
5
2
2
5
6
5
3
5
7
10
2
9
8
10
7
6
9
5
3
3
10
9
2
7
classifier on each bootstrap sample set
  Each
sample data point has probability (1 – 1/n)n
of being selected
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Boosting
  An
iterative procedure to adaptively change
distribution of training data by focusing more on
previously misclassified records
–  Initially, all N records are assigned equal
weights
–  Unlike bagging, weights may change at the
end of boosting round
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Boosting
  Records
that are wrongly classified will have their
weights increased
  Records that are classified correctly will have
their weights decreased
Original Data
Boosting (Round 1)
Boosting (Round 2)
Boosting (Round 3)
1
7
5
4
2
3
4
4
3
2
9
8
4
8
4
10
5
7
2
4
6
9
5
5
7
4
1
4
8
10
7
6
9
6
4
3
10
3
2
4
•  Example 4 is hard to classify
•  Its weight is increased, therefore it is more
likely to be chosen again in subsequent rounds
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Example: AdaBoost
Base classifiers: C1, C2, …,
CT
  Error rate:
 
εi =
1 N
∑ w j I (Ci ( x j ) ≠ y j )
N j =1
I(p)=1 if the predicate p is true;
0 otherwise
 
Importance of a classifier:
1 ⎛ 1 − ε i ⎞
⎟
2 ⎝ ε i ⎟⎠
αi = ln⎜⎜
© Tan,Steinbach, Kumar
Introduction to Data Mining
4/18/2004
‹#›
Example: AdaBoost
  Weight
update:
⎧⎪exp−α j if C j ( xi ) = yi
wi
⎨
α
⎪⎩ exp j if C j ( xi ) ≠ yi
where Z j is the normalization factor
( j +1)
wi( j )
=
Zj
  If
any intermediate rounds produce error rate
higher than 50%, the weights are reverted back to
1/n and the resampling procedure is repeated
  Classification:
T
C * ( x) = arg max ∑α jδ (C j ( x) = y )
y
© Tan,Steinbach, Kumar
j =1
Introduction to Data Mining
4/18/2004
‹#›
Illustrating AdaBoost
Initial weights for each data point
0.1
Original
Data
0.1
0.1
- - - - -
+++
Data points
for training
++
B1
Boosting
Round 1
0.0094
0.0094
- - - - - - -
+++
© Tan,Steinbach, Kumar
0.4623
Introduction to Data Mining
a= 1.9459
4/18/2004
‹#›
Illustrating AdaBoost
B1
Boosting
Round 1
0.0094
0.0094
+++
0.4623
- - - - - - -
a= 1.9459
B2
Boosting
Round 2
0.0009
0.3037
- - -
- - - - -
0.0422
++
a= 2.9323
B3
0.0276
0.1819
0.0038
Boosting
Round 3
+++
++ ++ + ++
Overall
+++
- - - - -
© Tan,Steinbach, Kumar
Introduction to Data Mining
a= 3.8744
++
4/18/2004
‹#›