Professional Documents
Culture Documents
[read Chapter 3]
[recommended exercises 3.1, 3.4]
Decision tree representation
ID3 learning algorithm
Entropy, Information gain
Overtting
Outlook
No Yes No Yes
Main loop:
1. A 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 leaf nodes
5. If training examples perfectly classied, Then
STOP, Else iterate over new leaf nodes
t f t f
1.0
Entropy(S)
0.5
X jSv j Entropy(S )
Gain(S; A) Entropy(S ) ?v2V alues v
A jS j ( )
t f t f
S: [9+,5-] S: [9+,5-]
E =0.940 E =0.940
Humidity Wind
Outlook
? Yes ?
Ssunny = {D1,D2,D8,D9,D11}
Gain (Ssunny , Temperature) = .970 − (2/5) 0.0 − (2/5) 1.0 − (1/5) 0.0 = .570
Gain (Ssunny , Wind) = .970 − (2/5) 1.0 − (3/5) .918 = .019
+ – +
...
A2
A1
+ – + + + – + –
...
A2 A2
+ – + – + – + –
A3 A4
–
+
... ...
No Yes No Yes
0.9
0.85
0.8
0.75
Accuracy
0.7
0.65
0.5
0 10 20 30 40 50 60 70 80 90 100
Size of tree (number of nodes)
0.9
0.85
0.8
0.75
Accuracy
0.7
0.65
0.5
0 10 20 30 40 50 60 70 80 90 100
Size of tree (number of nodes)
Outlook
No Yes No Yes
Temperature: 40 48 60 72 80 90
PlayTennis: No No Yes Yes Yes No
Problem:
If attribute has many values, Gain will select it
Imagine using Date = Jun 3 1996 as attribute
One approach: use GainRatio instead
Gain (S; A)
GainRatio(S; A) SplitInformation(S;A)
c jSij
X jS i j
SplitInformation(S;A) ? i jS j log jS j =1
2
Consider
medical diagnosis, BloodTest has cost $150
robotics, Width from 1ft has cost 23 sec.
How to learn a consistent tree with low expected
cost?
One approach: replace gain by
Tan and Schlimmer (1990)
Gain (S; A) : 2
Cost(A)
Nunez (1988)
2Gain S;A ? 1 ( )
(Cost(A) + 1)w
where w 2 [0; 1] determines importance of cost