Post on 21-Jan-2016
description
18/07/51 data mining classification basic concepts decision trees
1
Data Mining Classification: Basic Concepts, Decision Trees
Introduction to Data Miningเรี�ยบเรี�ยงโดย: นางสาวย พด� อมรีพงศาพ�นธ์�
48035493ว�ทยาการีคอมพ�วเตอรี� มหาว�ทยาบ�รีพา
data mining classification basic concepts decision trees
218/07/51
A spiral galaxy
กาแลกซี่��ขดเป็�นวงAn elliptical
galaxy
กาแลกซี่��รู�ป็วงรู�~*~ ภาพน��เป็�นการูทำ�า classification ของ galaxy
~*~
data mining classification basic concepts decision trees
318/07/51
Classification Definition
1
Building Algorithm
2
Pruning Algorithm
3
PUBLIC Algorithm
4
K-fold Cross-Validation
5
ห�วข้�อน�าเสนอ
Test of Significance
6
Confidence Interval for Accuracy
7
data mining classification basic concepts decision trees
418/07/51
Classification : Definition
Classification ค ออะไรี
Classification เก�#ยวก�บ Data mining อย$างไรี
จุ ดปรีะสงค�การีท�าClassification ค ออะไรี
Data Mining เป็�นว�ธี�การูน�าข�อมู�ลฝึ�กฝึน (Training Set) มูาจำ�าแนกโดยอาศั#ย
คุ%ณล#กษณะ (Attribute), ป็รูะเภทำ หรู*อ คุลาส(Class) ของแต่-ละข�อมู�ลน�ามูาสรู�างแบบจำ�าลอง(Model) ด�วยกรูะบวนการูเรู�ยนรู� �ด�วยเคุรู*�อง(Machine Learning)
Classification เป็�นแขนงหน/�งในการูทำ�า Data mining ซี่/�งเป็�นศัาสต่รู1ทำ��ใกล�เคุ�ยงก#บการูเรู�ยนรู� � ด�วยเคุรู*�องจำ#กรู(Machine Learning)โดยใช้�ข�อมู�ลฝึ�กฝึน (Training set) น�ามูาให�เคุรู*�องจำ#กรูเรู�ยนรู� � และสรู�างแบบจำ�าลองเพ*�อน�าไป็ใช้�ในการูทำ�านายผลข�อมู�ล โดยส-วนทำ��ต่�องการูทำ�านายจำะถู�กเรู�ยกว-า Class label or Class
จำ%ดป็รูะสงคุ1ของการูจำ#ดจำ�าแนกป็รูะเภทำ คุ*อสามูารูถูน�าแบบจำ�าลองทำ��สรู�างข/�นมูาทำ�านายข�อมู�ล
ทำ��ไมู-เคุยพบมูาก-อน (ข�อมู�ลในอนาคุต่ ) แล�วได�ผลล#พธี1ถู�กต่�องแมู-นย�าเป็�นทำ��น-าพอใจำ
data mining classification basic concepts decision trees
518/07/51
Classification Task
Apply
Model
Induction
Deduction
Learn
Model
Model
Tid Attrib1 Attrib2 Attrib3 Class
1 Yes Large 125K No
2 No Medium 100K No
3 No Small 70K No
4 Yes Medium 120K No
5 No Large 95K Yes
6 No Medium 60K No
7 Yes Large 220K No
8 No Small 85K Yes
9 No Medium 75K No
10 No Small 90K Yes 10
Tid Attrib1 Attrib2 Attrib3 Class
11 No Small 55K ?
12 Yes Medium 80K ?
13 Yes Large 110K ?
14 No Small 95K ?
15 No Large 67K ? 10
Test Set
Learningalgorithm
Training Set
induction
Training Set
Test Set
induction
data mining classification basic concepts decision trees
618/07/51
Decision Tree Induction
Algorithms ทำ��น�ามูาใช้�ในการูสรู�างต่�นไมู�ต่#ดส�นใจำ :Hunt’s Algorithm (เรู6ว)CART ID3, C4.5SLIQ,SPRINT
data mining classification basic concepts decision trees
718/07/51
TID Home Owner
Marital Status
Annual Income
Defaulted 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
Training Data Set
Categ
orica
l
Categ
orica
l
Contin
uous
Class L
abel
H_Owner
Marital
Income
No
Single, Divorced
YesNo
Married
Yes No
< 77 >= 77
Splitting Attribute
No
Model: Decision Tree
Example of Decision Tree
data mining classification basic concepts decision trees
818/07/51
Building Algorithm
ก�าหนดว�ธ์�การีแบ$งแยกข้�อม�ลท�#ม�อย�$ได�อย$างไรี เรูาจำะรูะบ% Attribute ให�เป็�นกล%-มูใด? เรูาจำะเล*อก Attribute มูาทำ�าการู Split ได�อย-างไรู?
เรีาจุะหย ดการีแบ$งแยกข้�อม�ลเม #อไรี เมู*�อทำ%กข�อมู�ลใน node น#�นเป็�น Class เด�ยวก#น เมู*�อทำ%กข�อมู�ลใน node น#�นมู�คุ-าของ Attribute เหมู*อนก#น ใช้�ว�ธี�หย%ดการูแต่กก��งเมู*�อคุวามูยาวเก�นคุ-าทำ��ก�าหนดซี่/�งเป็�นว�ธี�
Pre-Pruning (PUBLIC)
data mining classification basic concepts decision trees
918/07/51
ป็7จำจำ#ยทำ��ใช้�ในการูพ�จำารูณา Attribute Type
Nominal แบ-งเป็�นกล%-มูOrdinal แบ-งเป็�นกล%-มูโดยมู�การูเรู�ยงล�าด#บของกล%-มูContinuous เป็�นข�อมู�ลมู�คุวามูต่-อเน*�องก#น
จุ�านวนข้องทางท�#จุะแยก2 way split (Binary split)Multi-way split
data mining classification basic concepts decision trees
1018/07/51
ต่#วอย-างการู split
Add Your Text
ข้�อม�ลชน�ด Nominal Attribute (กล $ม)
ข้�อม�ลชน�ด Ordinal Attribute (ล�าด�บ)
ข้�อม�ลชน�ด Continuous Attribute (ต$อเน #อง)
accept
Yes No
color
Red,Blue Green
color
Red blue Green
level
Low,medium high
level
lowmedium
high
income
< 50 >= 50
income
< 10
[10, 20) [20, 30)
>= 30
data mining classification basic concepts decision trees
1118/07/51
คุ�าศั#พทำ1 Classification Attribute Type
Categorical ข�อมู�ลช้น�ดเป็�นกล%-มูContinuous หรู*อ Numeric เป็�นข�อมู�ลมู�คุวามูต่-อเน*�องก#น
หย%ดการูแบ-งแยกข�อมู�ลเมู*�อ เมู*�อทำ%กข�อมู�ลใน node น#�นเป็�น Class เด�ยวก#น เมู*�อทำ%กข�อมู�ลใน node น#�นมู�คุ-าของ Attribute เหมู*อนก#น
data mining classification basic concepts decision trees
1218/07/51
การูเล*อก Best Split
Input Data : 9 record of class 0, 11 record of class 1
Node ทำ��มู�คุวามูเป็�น Homogeneous มูากกว-า จำะมู�คุ%ณสมูบ#ต่�แยกข�อมู�ลได�ด�กว-า
C0 : 4C1 : 6
C0 : 5C1 : 5
C0 : 9C1 : 1
C0 : 0C1 : 10
Non- Homogeneousข�อมู�ลมู�ล#กษณะไมู-เหมู*อนก#น
Homogeneousข�อมู�ลมู�ล#กษณะเหมู*อนก#น
data mining classification basic concepts decision trees
1318/07/51
Measures of node impurity
Gini Index ( ค$าท�#บ$งบอกว$า attribute สมควรีน�ามาใช�เป+นค ณล�กษณะในการีแบ$ง )
Entropy ( การีค�านวณหาค$าความย $งเหย�งข้องข้�อม�ลกล $มหน.#ง )
Misclassification error (การีค�านวณความผิ�ดพลาดท�#เก�ดก�บโนด t)
Classification error(t) = 1 – Max[p(i|t)]i
Gini(t) = 1 - [p(i|t)]2
i=0
C-1
Entropy(t) = 1 - [p(i|t)] log2p(i|t)
i=0
C-1
data mining classification basic concepts decision trees
1418/07/51
Gini Index
C0 0
C1 6
C0 1
C1 5
จุากส�ตรี เม #อน�ามาทดสอบก�บต�วอย$างต$างๆก�น
Gini = 1 – (0/6)2 – (6/6)2
= 0
Gini = 1 – (1/6)2 – (5/6)2
= 0.278
Gini = 1 – (3/6)2 – (3/6)2
= 0.5
C0 3
C1 3
Gini(t) = 1 - [p(i|t)]2
i=0
C-1
data mining classification basic concepts decision trees
1518/07/51
Split based on Gini ค�านวณค$า split ได�จุาก
ต�วอย$างการีค�านวณ Owner
C0 : 8C1 : 2
C0 : 0C1 : 4
yes No
N1 N2
N1 N2
C0 8 0
C1 2 4
Gini(N1) = 1 – (8/10)2 – (2/10)2 = 0.32
Gini(N2) = 1 – (0/4)2 – (4/4)2 = 0
Ginisplit = (10/14)(0.32) + (4/14)(0)
= 0.2286
Ginisplit = 1 - ni/n Gini(i)
i=1
k
data mining classification basic concepts decision trees
1618/07/51
Examples for computing Entropy
C1 0
C2 6
C1 1
C2 5
P(C1) = 0/6 = 0 P(C2) = 6/6 = 1
Entropy = – 0 log2 0 – 1 log2 1 = – 0 – 0 = 0
P(C1) = 1/6 P(C2) = 5/6
Entropy = – (1/6) log2 (1/6) – (5/6) log2 (5/6) = 0.65
P(C1) = 2/6 P(C2) = 4/6
Entropy = – (2/6) log2 (2/6) – (4/6) log2 (4/6) = 0.92
j
tjptjptEntropy )|(log)|()(2
C1 2
C2 4
data mining classification basic concepts decision trees
1718/07/51
Splitting Based on INFO... Information Gain:
การีค�านวณค$า information gain (ซึ่.#งปรีะกอบด�วย entropy หลายค$ามารีวมก�น )เพ #อมาเปรี�ยบเท�ยบก�นแล�วเล อกค$าท�#ส�งส ด เพ #อต�องการีสรี�าง node ใน decision tree โดยเล อก attribute อ�นใดอ�นหน.#ง
k
i
i
splitiEntropy
nn
pEntropyGAIN1
)()(
data mining classification basic concepts decision trees
1818/07/51
Examples for Computing Error
C1 0
C2 6
C1 1
C2 5
P(C1) = 0/6 = 0 P(C2) = 6/6 = 1
Error = 1 – max (0, 1) = 1 – 1 = 0
P(C1) = 1/6 P(C2) = 5/6
Error = 1 – max (1/6, 5/6) = 1 – 5/6 = 1/6
P(C1) = 2/6 P(C2) = 4/6
Error = 1 – max (2/6, 4/6) = 1 – 4/6 = 1/3
)|(max1)( tiPtErrori
C1 2
C2 4
Measures misclassification error made by a node.
- Maximum (1 - 1/nc) เมู*�อ records การูกรูะจำายไป็ทำ%กๆ classes, แสดงว-าข�อมู�ลทำ��น-าสนใจำมู�น�อยมูาก
- Minimum (0.0) เมู*�อ ทำ%ก records อย�-ภายใน class เด�ยว,แสดงว-าข�อมู�ลมู�คุวามูน-าสนใจำมูาก
data mining classification basic concepts decision trees
1918/07/51
Comparison among Splitting Criteria
For a 2-class problem:
data mining classification basic concepts decision trees
2018/07/51
TID Home Owner
Marital Status
Annual Income
Defaulted 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
Training Data Set
Categ
orica
l
Categ
orica
l
Contin
uous
Class L
abel
Example Building phase
?
Split Attribute
การูหา Split Attributeจำะคุ�านวณหาคุ-า Ginisplit ทำ%กๆ Attributesโดย Attribute ทำ��มู�คุ-าน�อยทำ��ส%ด จำะเป็�น Split Attribute
data mining classification basic concepts decision trees
2118/07/51
Example Building phase
TID Home Owner
Marital Status
Annual Income
Defaulted 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
Training Data Set
Categ
orica
l
Categ
orica
l
Contin
uous
Class L
abel
Attribute Home Owner
Owner
C0 : 3C1 : 0
C0 : 4C1 : 3
yes No
N1 N2
Gini(N1) = 1 – (3/3)2 – (0/3)2 = 0
Gini(N2) = 1 – (4/7)2 – (3/7)2 = 0.4898
Ginisplit = (3/10)(0) + (7/10)(0.4898)
= 0.3429
data mining classification basic concepts decision trees
2218/07/51
Example Building phase
TID Home Owner
Marital Status
Annual Income
Defaulted 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
Training Data Set
Categ
orica
l
Categ
orica
l
Contin
uous
Class L
abel
Attribute Marital Status
Status
Single Married, Divorced
Status
Single, Married Divorced
Status
Single, Divorced Married
data mining classification basic concepts decision trees
2318/07/51
Example Building phaseAttribute Marital Status
Status
Single Married, Divorced
Status
Single, Married Divorced
Status
Single, Divorced Married
C0 : 2C1 : 2
C0 : 5C1 : 1
C0 : 6C1 : 2
C0 : 1C1 : 1
C0 : 3C1 : 3
C0 : 4C1 : 0
Gini(N1) = 1 – (2/4)2 – (2/4)2 = 0.5
Gini(N2) = 1 – (5/6)2 – (1/6)2 = 0.2778
Ginisplit = (4/10)(0.5) + (6/10)(0.2778)
= 0.3167Gini(N1) = 1 – (6/8)2 – (2/8)2 = 0.375
Gini(N2) = 1 – (1/2)2 – (1/2)2 = 0.5
Ginisplit = (8/10)(0.375) + (2/10)(0.5)
= 0.4000
Gini(N1) = 1 – (3/6)2 – (3/6)2 = 0.5
Gini(N2) = 1 – (4/4)2 – (0/0)2 = 0
Ginisplit = (6/10)(0.5) + (4/10)(0)
= 0.3000 <<<<<< Attribute ท�#ม�ค$าน�อยท�#ส ด
data mining classification basic concepts decision trees
2418/07/51
Example Building phase
Split Positions
Sorted Values
Attribute Annual Income
เน*�องจำากว-า Attribute Annual Income เป็�นแบบ Continuous ต่�องทำ�าการู Sort ให�เรู�ยงล�าด#บก#นก-อนกรูะจำาย Split Position บนข�อมู�ลทำ��เรู�ยงล�าด#บแล�ว หล#งจำากน#�นจำ/งทำ�าการูหาคุ-า Gini ของแต่-ละ Split Position คุ-าทำ��น�อยทำ��ส%ดจำะน�าไป็เป็รู�ยบเทำ�ยบก#บ Attribute อ*�นๆ
data mining classification basic concepts decision trees
2518/07/51
TID Home Owner
Marital Status
Annual Income
Defaulted 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
Training Data Set
Categ
orica
l
Categ
orica
l
Contin
uous
Class L
abel
Example Building phase
?
Split Attribute
Gini(Home Owner) = 0.3429
Gini(Marital Status) = 0.3000
Gini(Annual Income) = 0.3000
หากมู� 2 Attribute ทำ��มู�คุ-าน�อยทำ��ส%ดเทำ-าก#นจำะต่�องเล*อก Attribute ใด Attribute หน/�งเป็�น Split Attribute
data mining classification basic concepts decision trees
2618/07/51
Example Building phase
TID Home Owne
r
Marital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
เล*อกให� Marital Status เป็�น Split Attribute
?
Status
Single, Divorced Married
?
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
2 No Married 100K No
4 Yes Married 120K No
6 No Married 60K No
9 No Married 75K No
data mining classification basic concepts decision trees
2718/07/51
Example Building phase
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
2 No Married 100K No
4 Yes Married 120K No
6 No Married 60K No
9 No Married 75K No
เล*อกให� Marital Status เป็�น Split Attribute
?
Status
Single, Divorced Married
No
เน*�องจำากก��งทำางด�านขวาทำ��แต่กออกมูาเป็�น Class เด�ยวก#นทำ#�งหมูด จำ/งเป็ล��ยนให�เป็�น Leaf node
data mining classification basic concepts decision trees
2818/07/51
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
เล*อกให� Marital Status เป็�น Split Attribute
?
Status
Single, Divorced Married
No
เน*�องจำากก��งซี่�ายย#งไมู-ใช้- Class เด�ยวก#นทำ#�งหมูดและคุ-าใน Attribute ไมู-เหมู*อนก#นทำ#�งหมูดจำ/งทำ�าการู Split ต่-อ
Example Building phase
data mining classification basic concepts decision trees
2918/07/51
Attribute Home Owner
Gini(N1) = 1 – (2/2)2 – (0/0)2 = 0
Gini(N2) = 1 – (3/4)2 – (1/4)2 = 0.3750
Ginisplit = (2/6)(0) + (4/6)(0.3750)
= 0.2500
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
Example Building phase
data mining classification basic concepts decision trees
3018/07/51
Attribute Marital Status
Gini(N1) = 1 – (2/4)2 – (2/4)2 = 0.5
Gini(N2) = 1 – (1/2)2 – (1/2)2 = 0.5
Ginisplit = (4/6)(0.5) + (2/6)(0.5)
= 0.5000
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
Example Building phase
data mining classification basic concepts decision trees
3118/07/51
Attribute Annual IncomeTID Home
OwnerMarital Status
Annual Income
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
Example Building phase
Class No Yes Yes Yes No No
Income 70 85 90 95 125 220Split P 65 77 87 92 110 172 230
Yes
No
0 3
0 3
0 3
1 2
1 2 2 1
1 2 1 2
3 0
1 2
3 0
2 1
3 0
3 0Gini 0.5 0.4 0.5 0.44 0.25 0.35 0.5
data mining classification basic concepts decision trees
3218/07/51
?
Status
Single, Divorced Married
No
Gini(Home Owner) =
Gini(Marital Status) =
Gini(Annual Income) =
เน*�องจำากมู� 2 Attribute ทำ��มู�คุ-าน�อยทำ��ส%ดเทำ-าก#นทำ�าการูเล*อก Attribute ใด Attribute หน/�งเป็�น Split Attribute
TID Home Owne
r
Marital Status
Annual Incom
e
Defaulted Borrower
1 Yes Single 125K No
3 No Single 70K No
5 No Divorced 95K Yes
7 Yes Divorced 220K No
8 No Single 85K Yes
10 No Single 90K Yes
Example Building phase
0.25000.5000
0.2500
data mining classification basic concepts decision trees
3318/07/51
TID Home Owne
r
Marital Status
Annual Incom
e
Defaulted Borrower
1 Yes Single 125K No
7 Yes Divorced 220K No
เล*อกให� Home Owner เป็�น Split Attribute
Owner
Status
Single, Divorced Married
No
Yes No
? ?TID Home Owne
r
Marital Status
Annual Incom
e
Defaulted Borrower
3 No Single 70K No
5 No Divorced 95K Yes
8 No Single 85K Yes
10 No Single 90K Yes
N1
N2
Example Building phase
data mining classification basic concepts decision trees
3418/07/51
TID Home Owne
r
Marital Status
Annual Incom
e
Defaulted Borrower
1 Yes Single 125K No
7 Yes Divorced 220K No
เล*อกให� Home Owner เป็�น Split Attribute
Owner
Status
Single, Divorced Married
No
Yes No
?TID Home
Owner
Marital Status
Annual Incom
e
Defaulted Borrower
3 No Single 70K No
5 No Divorced 95K Yes
8 No Single 85K Yes
10 No Single 90K Yes
N1
N2
No
เน*�องจำากก��งทำางด�านซี่�ายทำ��แต่กออกมูาเป็�น Class เด�ยวก#นทำ#�งหมูด จำ/งเป็ล��ยนให�เป็�น Leaf node
Example Building phase
data mining classification basic concepts decision trees
3518/07/51
เล*อกให� Home Owner เป็�น Split Attribute
No
TID Home Owner
Marital Status
Annual Income
Defaulted Borrower
3 No Single 70K No
5 No Divorced 95K Yes
8 No Single 85K Yes
10 No Single 90K Yes
ทำ�ากรูะบวนการูเด�มูซี่��าจำะได� Annual Incomeเป็�น Node ส%ดทำ�าย มู�คุ-า Split Value 77
ได�เป็�นต่�นไมู�ด#งรู�ป็
Yes No
Owner
Status
Single, Divorced Married
No Income
No Yes
< 77 >= 77
Example Building phase
data mining classification basic concepts decision trees
3618/07/51
Overfitting Problem (ป2ญหาการีเข้�าก�นเก�นไป )
ป็7ญหาการู Overfitting คุ*อการูทำ�� Model ทำ��ได�จำากการูใช้� Training Data set มู�คุ-าคุวามูถู�กต่�องในการูบ-งบอกคุลาสเป็;าหมูายส�ง แต่-เมู*�อน�าไป็ใช้�ก#บข�อมู�ล Test Data set ได�คุ-าคุวามูถู�กต่�องต่��า
กล-าวอ�กน#ยหน/�งคุ*อ ต่#วแบบทำ��ได�เป็�นการูเรู�ยนรู� �ข�อมู�ลจำาก Training Data set ด�มูาก แต่-ไมู-สามูารูถูน�าไป็ใช้�ก#บข�อมู�ลทำ��ไมู-เคุยพบมูาก-อนได�ด�
ต่�นไมู�ทำ��แสดงล#กษณะป็7ญหา Overfitting มู#กเป็�นต่�นไมู�ทำ��มู�การูแต่กก��งมูากมูาย แต่-ละก��งมู�จำ�านวนข�อมู�ลอย�-ป็รู�มูาณน�อย
ว�ธี�การูหล�กเล��ยงป็7ญหา Overfitting ในต่�นไมู�ทำ�าได� 2 ล#กษณะ ต่#ดแต่-งก��งรูะหว-างสรู�าง(Pre-Pruning) หย%ดการูสรู�างเมู*�อต่#วว#ดการู
แต่กก��งมู�คุ-าต่��ากว-าเกณฑ์1ทำ��ก�าหนด เช้-นข�อมู�ลในจำ%ดยอดมู�น�อยเก�นไป็ ต่#ดแต่-งก��งหล#งสรู�าง(Post-Pruning) การูลดจำ�านวนก��ง ก�าจำ#ดก��ง
โดยย#งคุงคุวามูถู�กต่�องของการู Classification ในรูะด#บทำ��ยอมูรู#บได�
data mining classification basic concepts decision trees
3718/07/51
Pruning Algorithm
แก�ป็7ญหา Overfitting ด�วยว�ธี� Minimum Desciption Length (MDL)
MDL เป็�นการูหาต่�นไมู�ทำ��ด�ทำ��ส%ดจำากการูเข�ารูห#ส (encode) ของข�อมู�ล ต่�นไมู�ทำ��เข�ารูห#สแล�วมู�ขนาดส#�นทำ��ส%ดคุ*อต่�นไมู�ทำ��ด�ทำ��ส%ดน#�นเอง
การูเข�ารูห#ส Structure ของต่�นไมู� โคุรูงสรู�างของต่�นไมู�จำะถู�กแทำนทำ��ด�วย รูห#สในแบบ prefix
Internal node แทำนด�วย 1 Leaf แทำนด�วย 0
ต่�นไมู�ทำางด�านขวาจำะถู�กเข�ารูห#สเป็�น 11000 ทำ%กๆ node จำะใช้� 1 bit
data mining classification basic concepts decision trees
3818/07/51
Pruning Algorithm การูเข�ารูห#ส การูเข�ารูห#ส Split Attribute
คุ-าทำ��ใช้� Spit (Csplit) มู�สองส-วน คุ*อ เข�ารูห#ส Attribute และคุ-าทำ��ใช้�ในการู split
การูเข�ารูห#ส Attribute ใช้� log a bits เมู*�อ a คุ*อจำ�านวนของ Attributes
การูเข�ารูห#ส Spit value แบ-งต่ามูช้น�ดโดยทำ��Categorical ใช้� log (2v – 1) bits เมู*�อ v คุ*อจำ�านวน
สมูาช้�กของ AttributeNumeric ใช้� log (v - 1) bits เมู*�อ v คุ*อช้-วงคุ-าทำ��ใช้�แบ-ง
ของ Attribute (v = max-min)
การูเข�ารูห#ส ข�อมู�ลและ Class n ค อ จุ�านวนสมาช�กข้องท ก class ในท กๆ nodes รีวมก�น ni ค อ จุ�านวนสมาช�กท�#เป+น class i ณ โหนดหน.#งๆ
C(s) = nilog (n/ni)i
data mining classification basic concepts decision trees
3918/07/51
Pruning Algorithm ข้�อผิ�ดพลาดข้อง MDL Pruning
ในการีเข้�ารีห�สข้อง Csplit ม�โอกาสท�#จุะเก�ด Overfitting และ Overpruning ได� ในบาง Data set
Numeric Attribute ถ้�าข้�อม�ลม�จุ�านวนน�อยมาก หรี อส�งมากจุนเก�นไป เช$น 0123. ถ้.ง - 0123. จุะท�าให�ค$า Csplit ม�ค$าน�อยมากๆ หรี อ 1 ,000, - 000 2,000, 000 ก6จุะท�าให� Csplit ม�ค$ามากจุนเก�นไป
Categorical Attribute ถ้�าข้�อม�ลม�จุ�านวนชน�ดกล $มมากเก�นไป ค$า Csplit จุะส�งมากจุนเก�ดการี Overpruning
ด�งน�7นการีแทน Csplit ด�วยค$าคงท�# ซึ่.#งจุะท�าให�เป+นมาตรีฐานส�าหรี�บการี prune ส�าหรี�บท ก Data set และช$วยป9องก�นการีเก�ด Overfitting และ Overpruning
data mining classification basic concepts decision trees
4018/07/51
Pruning AlgorithmProcedure computeCost&Prune(Node N):
/* S คุ*อ set ของข�อมู�ลทำ#�งหมูดทำ�� Node N */1. If N is a leaf return C(S) + 1
/* N1 and N2 are N’s children */
2. minCost1 = computeCost&Prune(N1);
3. minCost2 = computeCost&Prune(N2);
4. minCostN = min{C(S) + 1, Csplit(N) + 1 + minCost1 + minCost2};
5. if minCostN = C(S) + 1
prune child nodes N1 and N2 from tree
6. return minCostN
data mining classification basic concepts decision trees
4118/07/51
< 77 >= 77
C0 : 5C1 : 0
C0 : 0C1 : 2
Income
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
Example Pruning Phase
If N is a leaf return C(S) + 1 no
minCost1 = computeCost&Prune(N1);If N1 is a leaf return C(S) + 1 no
minCost1 = computeCost&Prune(N1);If N1 is a leaf return C(S) + 1 yes
minCost2 = computeCost&Prune(N2);If N2 is a leaf return C(S) + 1 no
minCost1 = computeCost&Prune(N1);If N1 is a leaf return C(S) + 1 yes
minCost2 = computeCost&Prune(N2);If N2 is a leaf return C(S) + 1 yes
data mining classification basic concepts decision trees
4218/07/51
Example Pruning Phase
< 77 >= 77
เน*�องจำากเป็�นฟั7งก1ช้# �น recursive จำะทำ�างานจำากล-างข/�นบนด#งน#�นจำ/งเรู��มูทำ�� node Income
หาคุ-า minCost ทำ�� Node Income
minCostN = min{C(S) + 1, Csplit(N) + 1 + minCost1 + minCost2};
คุ�านวณหาคุ-าC(S) + 1
และ Csplit(N) + 1 + minCost1 + minCost2
C0 : 5C1 : 0
C0 : 0C1 : 2
Income
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
data mining classification basic concepts decision trees
4318/07/51
Example Pruning Phase
C0 : 5C1 : 0
< 77 >= 77
C0 : 0C1 : 2
Income
C(S) + 1 = (5log(7/5) + 2log(7/2)) + 1 = (5(0.485) + 2(1.807)) + 1 = 3 + 4 + 1 = 8
Csplit(N) = log(a) + log(v-1) = log(3) + log((220-70) - 1) = 2 + 8 = 10
minCost2 = C(N2) + 1 = (0log(2/0) + 2log(2/2)) + 1 = 1
minCost1 = C(N1) + 1 = 5log(5/5) + 0log(5/0) + 1 = 1minCostN = min{C(S) + 1, Csplit(N) + 1 + minCost1 + minCost2};
= min{8 , 10 + 1 + 1 + 1}; = 8 C(s)+1 = nilog (n/ni)+1
i
data mining classification basic concepts decision trees
4418/07/51
ทำ�าการู prune child node ออกเพรูาะ minCostN = C(S) + 1
node Income จำะถู�กเป็ล��ยนเป็�น leafโดยมู�คุ-าเป็�น Class ทำ��จำ�านวนมูากทำ��ส%ด
Income
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
C0 : 5C1 : 0
C0 : 0C1 : 2
< 77 >= 77
Example Pruning Phase
data mining classification basic concepts decision trees
4518/07/51
ทำ�าการู prune child node ออกเพรูาะ minCostN = C(S) + 1
node Income จำะถู�กเป็ล��ยนเป็�น leafโดยมู�คุ-าเป็�น Class ทำ��จำ�านวนมูากทำ��ส%ด
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
C0 : 5C1 : 2
Example Pruning Phase
data mining classification basic concepts decision trees
4618/07/51
ท�าการี prune child node ออกเพรีาะ minCostN = C(S) + 1
node Income จำะถู�กเป็ล��ยนเป็�น leafโดยมู�คุ-าเป็�น Class ทำ��จำ�านวนมูากทำ��ส%ด
ทำ�าการูคุ�านวณ minCost ทำ�� Node Ownerโดยทำ�� minCost2 = 10
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
C0 : 5C1 : 2
Example Pruning Phase
data mining classification basic concepts decision trees
4718/07/51
Example Pruning Phase
minCostN = min{C(S) + 1 ,Csplit(N) + 1 + minCost1 + minCost2}; = min{32, 4 + 1 + 22 + 8}; = min{32, 35}; = 32
= (105log(110/105) + 5log(110/5)) + 1 = (105(0.067) + 5(4.459) + 1) = 8 + 23 + 1 = 32
= log(3) + log(22-1)= 2 + 2= 4
= 100log(103/100) + 3log(103/3) + 1= 100(0.0426) + 3(5.1015) + 1= 5 + 16 + 1= 22
minCost2
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
C0 : 5C1 : 2
C(S) + 1
Csplit(N)
minCost1
= 8
data mining classification basic concepts decision trees
4818/07/51
Example Pruning Phase
C0 : 5C1 : 2
Yes No
Owner
Status
Single, Divorced Married
C0 : 100C1 : 3
C0 : 3C1 : 100
ทำ�าการู prune child node ออกเพรูาะ minCostN = C(S) + 1
node Income จำะถู�กเป็ล��ยนเป็�น leafโดยมู�คุ-าเป็�น Class ทำ��จำ�านวนมูากทำ��ส%ด
data mining classification basic concepts decision trees
4918/07/51
Example Pruning Phase
Status
Single, Divorced Married
C0 : 3C1 : 100
C0 : 105C1 : 5
ทำ�าการู prune child node ออกเพรูาะ minCostN = C(S) + 1
node Income จำะถู�กเป็ล��ยนเป็�น leafโดยมู�คุ-าเป็�น Class ทำ��จำ�านวนมูากทำ��ส%ด
data mining classification basic concepts decision trees
5018/07/51
Example Pruning Phase
ค�านวณค$า mincost ท�#จุ ดยอด
minCostN = min{C(S) + 1 ,CSplit(N) + 1 + minCost1 + minCost2}; = min{214 , 5 + 1 + 32 + 22}; = 60
ค$า mincostN ไม$เท$าก�บ C(S) + 1 ด�งน�7นไม$ต�อง prune ท�#จุ ดยอด (60 ไม$เท$าก�บ 214)
= 108log(213/108) + 105log(213/105) + 1
= 108(0.98) + 105(1.02)= 106 + 108= 214
= log(3) + log(23-1) = 2 + 3 = 5
minCost1 = 32
= 3log(103/3) + 100log(103/100) + 1= 3(5.101) + 100(0. 426) + 1= 16 + 5 + 1= 22
Status
Single, Divorced Married
C0 : 3C1 : 100
C0 : 105C1 : 5
C(S) + 1
Csplit(N)minCost2
data mining classification basic concepts decision trees
5118/07/51
Status
Single, Divorced Married
YesNo
Example Pruning Phase
After pruning
data mining classification basic concepts decision trees
5218/07/51
Pruning Algorithm
สรู%ป็การู pruning ด�วยว�ธี� MDLเมู*�อ Node มู�จำ�านวนสมูาช้�กน�อยมูากๆ เมู*�อเทำ�ยบก#บโหด
อ*�นๆจำะถู�ก prune ออก เน*�องจำากคุ-าในการูเข�ารูห#สของ Split Attribute และ Split value รูวมูก#บคุ-าในการูเข�ารูห#สของทำ#�งสองก��งจำะมู�คุ-ามูาก เมู*�อเทำ�ยบก#บการูรูวมูไว�เป็�น node เด�ยวก#น
เมู*�อใน Internal node ใดมู�คุ-าของผลรูวมูทำ#�งหมูดเอ�ยงไป็ทำาง class ใดมูาก จำะถู�กรูวมูเข�าไว�เป็�น node เด�ยวก#นเน*�องจำากคุ-าในการูเข�ารูห#สถู�กกว-า
data mining classification basic concepts decision trees
5318/07/51
PUBLIC Algorithm
PUBLIC (PrUning and BuiLding Integrated in Classification) เป็�นเทำคุน�คุเพ��มูป็รูะส�ทำธี�ภาพและคุวามูเรู6วในการูคุ�านวณผล รูวมูการู Building และ Pruning ไว�ในข#�นต่อนเด�ยว
แนวคุ�ดคุ*อ ทำ�าการูคุ�านวณคุ-า Lower Bound คุ*อคุ-าใช้�จำ-ายข#�นต่��าในการูแต่กก��งก-อนทำ�าการูหาคุ-า split attribute ซี่/�งหากคุ-าข#�นต่��าทำ��ใช้�ในการูแต่กก��งมูากกว-าคุ-าทำ��เข�ารูห#สของ node น#�น ก6จำะหย%ดการูแต่กก��งทำ�าให�ใช้�เวลาในการูคุ�านวณน�อยลง
data mining classification basic concepts decision trees
5418/07/51
PUBLIC Algorithm อ#ลกอล�ทำ/มูของ PUBLIC จำะใช้�ของ Building รูวมูก#บ Pruning โดยจำะ
แทำรูกการู Pruning หล#งจำากทำ�าการู split node ไป็ได�รูะยะหน/�ง เมู*�อทำ�าการู Pruning จำะมู�การูแบ-งช้น�ดของ leaves ออกเป็�น 3 แบบ คุ*อ“yet to be expanded” คุ*อ leaf node ทำ��อย�-ในข#�นก�าล#งแต่กก��ง“pruned” คุ*อ leaf node ทำ��ถู�ก prune แล�ว“not expandable” คุ*อ leaf node ทำ��ไมู-สามูารูถูแบ-งได�อ�กแล�ว
อ#ลกอล�ทำ/มูของ pruning ทำ��น�ามูาใช้�จำะมู�การูเป็ล��ยนแป็ลงเล6กน�อย โดยการูคุ�านวณคุ-า mincost ของleaf node ทำ��เป็�น“yet to be expanded” จำะถู�กน�าไป็คุ�านวณคุ-า lower bound แทำนทำ��จำะเป็�นคุ-า C(s) เพรูาะหากว-าน�าคุ-า C(s) ไป็คุ�านวณ คุ-าทำ��ได�จำะไมู-ต่รูงก#บคุวามูจำรู�งเมู*�อมู�การูแต่กก��งออกไป็
data mining classification basic concepts decision trees
5518/07/51
PUBLIC AlgorithmProcedure computeCost&Prune(Node N):
/* S คุ*อ set ของข�อมู�ลทำ#�งหมูดทำ�� Node N */if N is a “yet to be expanded” leaf
return lower bound on subtree cost at Nif N is a “pruned” or “not expandable” leaf
return C(S) + 1 /* N1 และ N2 ล�กข้อง N */
minCost1 = computeCost&Prune(N1);minCost2 = computeCost&Prune(N2);minCostN = min{C(S) + 1,
Csplit(N) + 1 + minCost1 +
minCost2};if minCostN = C(S) + 1
prune child nodes N1 and N2 from tree
return minCostN
data mining classification basic concepts decision trees
5618/07/51
PUBLIC Algorithm
ท�าการี split ข้�อม�ลแบ$งออกเป+น 2 กล $ม• คุ�ดคุ-า Lower bound ทำ#�งสอง leaf และรู�เทำ�รู1นให� root node
LB LB
• ถู�าคุ-าทำ��รูวมูจำาก lower bound น�อยกว-า ทำ�าการู split ต่-อ
ทำ�าการู pruning คุ�ดคุ-า Lower bound ของใบทำ��เป็�น “yet to be expanded” แล�วรู�เทำ�รู1นคุ-าไป็ให� internal node
LB LB LB
ถู�าคุ-าทำ��รูวมูจำาก Lower bound น�อยกว-า ทำ�าการู split ต่-อ แต่-ถู�ามูากกว-าให�ทำ�าการู prune node น#�น
สรู�างและพรู%น สล#บก#นไป็จำนคุรูบทำ#�งต่�นไมู�
data mining classification basic concepts decision trees
5718/07/51
PUBLIC Algorithm
PUBLIC มู�อย�-ด�วยก#น 3 แบบคุ*อPUBLIC(1) แทำนคุ-า lower bound ด�วย 1PUBLIC(S) แทำนคุ-า lower bound เพ��มูคุ-าข/�นโดยการู
คุ�านวณ จำ�านวนคุรู#�งทำ��น�อยทำ��ส%ดทำ��แบ-งก��งได�อ�ก และเพ��มูคุ-าของ attribute log(a) รูวมูทำ#�ง bits ทำ��ใช้� ต่ามูจำ�านวนคุรู#�งทำ��แบ-งน#�น
PUBLIC(V) แทำนคุ-า lower bound ด�วยคุ-าทำ��คุ�านวณจำากPUBLIC(S) และเพ��มูคุ-าของ split value ทำ��ต่��าทำ��ส%ดเข�าไป็
data mining classification basic concepts decision trees
5818/07/51
K-fold Cross-Validation คุรูอสวาล�เดช้#�น (Cross Validation ) คุ*อว�ธี�การูในการูคุาดการูคุ-าคุวามู
ผ�ดพลาดของโมูเดล หรู*อ ว�ธี�การูทำ��เรูาน�าเสนอ โดยพ*�นฐานของว�ธี�การูคุรูอสวาล�เดช้#�นคุ*อการูส%-มูต่#วอย-าง (resampling ) โดยเรู��มูจำากแบ-งช้%ดข�อมู�ลออกเป็�นส-วนๆ และน�าบางส-วนจำากช้%ดข�อมู�ลน#�นมูาต่รูวจำสอบ ผลล#พทำ1จำากการูทำ�าคุรูอสวาล�เดช้#�นมู#กถู�กใช้�เป็�นต่#วเล*อกในการูก�าหนดโมูเดล อาธี�เช้-น สถูาป็7ต่ยกรูรูมูเคุรู*อข-ายการูส*�อสารู (network architecture), โมูเดลในการูคุ#ดแยกป็รูะเภทำ(classification model)
ในกรูณ�การูทำ�า K - - fold cross validation เรูาจำะแบ-งข�อมู�ลออกเป็�น K ช้%ดเทำ-าๆก#น และทำ�าการูคุ�านวณคุ-าคุวามูผ�ดพลาด K รูอบ โดยแต่-ละรูอบการูคุ�านวณข�อมู�ลช้%ดหน/�งจำากข�อมู�ล K ช้%ดจำะถู�กเล*อกออกมูาเพ*�อเป็�นข�อมู�ลทำดสอบ และข�อมู�ลอ�ก K - 1 ช้%ดจำะถู�กใช้�เป็�นข�อมู�ลส�าหรู#บการูเรู�ยนรู� �
data mining classification basic concepts decision trees
5918/07/51
K-fold Cross-Validation
1 2 3 4 5
Data Set
1 2 4 53
21 3 4 5
51 3 42
รูอบทำ�� 1
รูอบทำ�� 2
รูอบทำ�� 5
.
.
.
data mining classification basic concepts decision trees
6018/07/51
Leave-one-out cross-validation คุ*อการูทำ�า K - fold cross-validation เมู*�อก�าหนดให� K มู�คุ-าเทำ-าก#บจำ�านวนข�อมู�ลทำ#�งหมูด ด#งน#�นในกรูณ�ทำ��เรูามู�ข�อมู�ล 10 ช้��น จำะต่�องทำ�าการูว#ดผลคุวามูผ�ดพลาดโดยว�ธี�การู 10-fold cross-validation โดยทำ��ในแต่-ละกล-องบรูรูจำ%ข�อมู�ล 1 ช้��น
K-fold Cross-Validation
data mining classification basic concepts decision trees
6118/07/51
Test of Significance (คุวามูส�าคุ#ญในการูทำดสอบ)
ให� models มูา 2 model ให�พ�จำารูณา:Model M1: คุ-าคุวามูแมู-นย�า = 85%, ทำดสอบ 30 กรูณ�Model M2: คุ-าคุวามูแมู-นย�า = 75%, ทำดสอบ 5000
กรูณ�
เรูาสามูารูถูบอกได�ไหมูว-า M1 ด�กว-า M2?เรูาจำะแน-ใจำได�อย-างไรูว-าคุ-าคุวามูแมู-นย�า M1 และ M2 ทำ��ให�มูา
น�าไป็พ�จำารูณาได�?คุวามูแต่กต่-างในการูว#ดสามูารูถูอธี�บายผลการูส%-มูทำ��ข/�นๆลงๆ
ในการู test set?
data mining classification basic concepts decision trees
6218/07/51
Confidence Interval for Accuracy(คุวามูมู#�นใจำในช้-วงคุวามูแต่กต่-างของคุ-าคุวามูแมู-นย�า)
การูทำ�านายสามูารูถูพ�จำารูณาจำาก Bernoulli trial Bernoulli trial มู� 2 คุวามูเป็�นไป็ได�ทำ��ต่ามูมูา
ป็7ญหาทำ��ต่ามูมูาในการูทำ�านาย : ถู�ก หรู*อ ผ�ดCollection ของ Bernoulli trials มู�การูแบ-งต่ามูคุณ�ต่ศัาต่
รู1 : x Bin(N, p) x: คุ-าคุวามูถู�กต่�องในการูทำ�านาย e.g: โยนเหรู�ยญ 50 คุรู#�ง, มู�ก��คุรู# �งทำ��ออกห#ว?
คุ-าของการูทำ�านายทำ��จำะออกห#ว = Np = 50 0.5 = 25 คุรู#�ง
ให� x (# คุ-าคุวามูถู�กต่�องของการูทำ�านาย) หรู*อเทำ�ยบเทำ-า, acc=x/N, and N (# จำ�านวนกรูณ�ทำ��ใช้�การูทำดสอบ),
เรูาสามูารูถูทำ�านาย p (คุวามูแมู-นย�าทำ��ถู�กต่�อง ของแบบจำ�าลอง)ได�หรู*อไมู-?
data mining classification basic concepts decision trees
6318/07/51
Confidence Interval for Accuracy
ส�าหรู#บ test sets ทำ��ขนาดใหญ- (N > 30), acc มู�การูกรูะจำายแบบป็กต่�
ก#บคุ-าเฉล��ย p และ แป็รูผ#นต่ามู p(1-p)/N
คุวามูมู#�นใจำในคุวามูแต่กต่-างของ p:
1
)/)1(
(2/12/
ZNpp
paccZP
Area = 1 -
Z/2 Z1- /2
)(2
4422
2/
22
2/
2
2/
ZN
accNaccNZZaccNp
data mining classification basic concepts decision trees
6418/07/51
Confidence Interval for Accuracy
พ�จำารูณา model น��มู�ผลทำ��ให� คุ-าคุวามูแมู-นย�า(accuracy) = 80% เมู*�อมู�คุ-าการู test 100 กรูณ�:N=100, acc = 0.8ให� 1- = 0.95 (95% เป็�นคุ-า
คุวามูมู#�นใจำ)จำากต่ารูางคุวามูน-าจำะเป็�น,
Z/2=1.96
1- Z
0.99
2.58
0.98
2.33
0.95
1.96
0.90
1.65
N 50 100 500 1000 5000
p(lower) 0.670 0.711 0.763 0.774 0.789
p(upper) 0.888 0.866 0.833 0.824 0.811
data mining classification basic concepts decision trees
6518/07/51
Comparing Performance of 2 Models(เป็รู�ยบเทำ�ยบ 2 model) ให� 2 models, บอกว-า M1 และ M2, อ#นไหนจำะด�กว-า?
M1 คุ*อ tested บน D1(ฐานข�อมู�ล) (size=n1), พบอ#ต่รูา error = e1
M2 คุ*อ tested บน D2 (size=n2), พบอ#ต่รูา error = e2
สมูมู%ต่� D1 และ D2 เป็�นอ�สรูะต่-อก#นถู�า n1 และ n2 ใหญ-พอ, แล�ว
ส�ต่รูป็รูะมูาณน��:
222
111
,~
,~
Ne
Ne
i
ii
i nee )1(
ˆ
data mining classification basic concepts decision trees
6618/07/51
Comparing Performance of 2 Models
จำะ test ถู�า แสดงคุ-าคุวามูแต่กต่-าง (performance difference) คุ*อ ข/�นอย�-ก#บสถู�ต่�(statistically significant): d = e1 – e2d ~ NN(dt,t) เมู*�อ dt คุ*อ คุวามูแต่กต่-างจำรู�ง (true
difference)เมู*�อ D1 และ D2 เป็�นอ�สรูะต่-อก#น, เหล-าน�� แป็รูผ#นมูากข/�น:
ทำ�� คุ-าคุวามูมู#�นใจำ (1-)
2)21(2
1)11(1
ˆˆ 2
2
2
1
2
2
2
1
2
nee
nee
t
ttZdd
ˆ
2/
data mining classification basic concepts decision trees
6718/07/51
An Illustrative Example
ให�: M1: n1 = 30, e1 = 0.15 M2: n2 = 5000, e2 = 0.25
d = |e2 – e1| = 0.1 (ทำดสอบทำ#�ง 2 ข�าง)
ทำ��คุ-าคุวามูมู#�นใจำ 95%, Z/2=1.96
=>รูะยะห-าง (Interval contains) 0 => คุวามูแต่กต่-างไมู-มู�ส�าคุ#ญก#บสถู�ต่�
0043.05000
)25.01(25.030
)15.01(15.0ˆ d
128.0100.00043.096.1100.0 td
data mining classification basic concepts decision trees
6818/07/51
Comparing Performance of 2 Algorithms
แต่-ละ learning algorithm จำะให�ผล k models:L1 มู� M11 , M12, …, M1kL2 มู� M21 , M22, …, M2k
ถู�า models สรู�าง test sets ทำ��เหมู*อนๆก#น D1,D2, …, Dk (เช้-น via cross-validation)แต่-ละ set: คุ�านวณจำาก dj = e1j – e2j
dj มู�คุ-าเฉล��ย dt และแป็รูผ#นต่ามู t
ว�เคุรูาะห1จำาก:
tkt
k
j j
t
tdd
kk
dd
ˆ
)1(
)(ˆ
1,1
1
2
2
data mining classification basic concepts decision trees
6918/07/51
Thank you ขอบคุ%ณคุ-ะ...จำบ
การูน�าเสนอ