Escolar Documentos
Profissional Documentos
Cultura Documentos
Inference
Learning Data
Attributes
Day
D1
D2
D3
D4
D5
D6
D7
D8
D9
D10
D11
D12
D13
D14
Outlook
Sunny
Sunny
Overcast
Rain
Rain
Rain
Overcast
Sunny
Sunny
Rain
Sunny
Overcast
Overcast
Rain
Tem p
Hot
Hot
Hot
Mild
Cool
Cool
Cool
Mild
Cool
Mild
Mild
Mild
Hot
Mild
Hum idity
High
High
High
High
Normal
Normal
Normal
High
Normal
Normal
Normal
High
Normal
High
W ind
Weak
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Strong
PlayTennis
No
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
PlayTennis
Learned function is a tree
Classify instances
Outlook
Sunny
Sunny
Overcast
Rain
Rain
Rain
Overcast
Sunny
Sunny
Rain
Sunny
Overcast
Overcast
Rain
Tem p
Hot
Hot
Hot
Mild
Cool
Cool
Cool
Mild
Cool
Mild
Mild
Mild
Hot
Mild
Hum idity
High
High
High
High
Normal
Normal
Normal
High
Normal
Normal
Normal
High
Normal
High
W ind
Weak
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Strong
PlayTennis
No
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
A good attribute
Poor attribute
it provides no discrimination
attribute is immaterial to the decision
for each value we have same number of
positive and negative instances
Entropy:
11
Entropy
Illustration:
S is a collection of 14 examples with 9 positive
and 5 negative examples
Entropy of S relative to the Boolean
classification:
12
Entropy (S ) pi log2 pi
i =1
13
Information Gain
14
| Sv |
Gain( S , A) Entropy ( S )
Entropy ( S v )
vValues ( A ) | S |
15
Info[2,3]=0.97 bits
Info[3,2]=0.97 bits
Info[4,0]=0 bits
Info(2,3)=0.97
Info(0,2)=info(1,0)=0
Info(1,1)=0.5
Ave Info=0+0+(1/5)
Gain(temp)=0.97- 0.2 =0.77 bits
17
Info(3,3)=1
Info(2,2)=Info(1,1)=1
Gain(windy)=1-1
=0 bits
18
19
Answer
20
21
values v1, v2
and v3 of
Attribute A
{Attributes} - A
Label = -
22
Label = +
23
Begin
A the attribute from Attributes that best* classifies Examples
The decision attribute (feature) for Root A
For each possible value vi, of A,
Then below this new branch, add a leaf node with label = most common value of
Target_attribute in Examples
Else, below this new branch add the subtree
ID3(Examplesvi,Target_attribute, Attributes - {A})
End
Return
Root
Gain( S , A) Entropy ( S )
The
24
| Sv |
Entropy ( S v )
|
S
|
vValues ( A )
best attribute is the one with the highest information gain, as defined in Equation:
Perfect feature
25
26
Outlook
Sunny
Sunny
Overcast
Rain
Rain
Rain
Overcast
Sunny
Sunny
Rain
Sunny
Overcast
Overcast
Rain
Temp
Hot
Hot
Hot
Mild
Cool
Cool
Cool
Mild
Cool
Mild
Mild
Mild
Hot
Mild
Humidity
High
High
High
High
Normal
Normal
Normal
High
Normal
Normal
Normal
High
Normal
High
Wind
Weak
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Weak
Weak
Strong
Strong
Weak
Strong
PlayTennis
No
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
27
Best prediction of
target attribute
Figure 3.3
28
29
Humidity is a perfect feature since there is no uncertainty left when we know its value
30
Figure 3.5
31
32
33
34
35
learning to classify
medical patients by their disease
equipment malfunctions by their cause
loan applications by by likelihood of defaults on
payments
36
37