Professional Documents
Culture Documents
DM DT Solved Example 01 - Unlocked
DM DT Solved Example 01 - Unlocked
Which feature will be at the root node of the decision tree trained for
the following data? Then draw the Decision Tree (DT) for this training
data.
Decision
Employed Age Have House
(Give Credit)
No Middle Age No No
Yes Old No No
Yes Middle Age Yes Yes
Yes Old Yes No
No Old Yes No
Yes Young Yes Yes
Yes Middle Age No No
No Middle Age Yes Yes
Solution:
Step 1: Find the Entropy of the parent node (in this example it is Decision):
Entropy parent = -5/8 log 2 (5/8) -3/8 log 2 (3/8) = 0.954
Yes=3
No= 5
1
Step 2: Find the Information Gain of the children nodes:
*Information Gain= Entropy Parent – [Average children Entropy]
1- Employed Attribute:
Yes=1
No = 2
Yes=3
No= 5
Yes=2
No= 3
2- Age Attribute:
Yes=2
No= 2
Yes=3
No= 3
No= 5
Yes=1
2
3- Have House Attribute:
No=3
Yes=3
No= 5
Yes=3
No=2
3
4