Apply decision tree classifier and hence classify following tuple, <Old, Yes, Hardware>
Solution:
Here the output column is Profit with 2 values(Down and Up)
Entropy of the whole Dataset is:
Step 2: Information Gain for Age
For (Age=Old), all 3 records have Profit = Down, Entropy(SOld)=0
For (Age=Mid), there are 2 Down and 2 Up, Entropy(SMid)=1
For (Age=New), all 3 records have Profit = Up, Entropy(SNew)=0
Calculate Information Gain for Competition
Calculate Information Gain for Type
For (Type=Software), there are 3 Down and 3 Up, Entropy(SSoftware)=1
For (Type=Hardware), there are 2 Down and 2 Up, Entropy(SHardware)=1
Compare all the 3 gains to choose the root node
The root node selected is Age:
For Old branch and New branch we can assign labels but not for Mid branch:
Consider Mid dataset:
Consider Competition:
For Yes, it is Down, Entropy(Syes)= 0
For No, it is Up, Entropy(Sno)=0
Consider Type:
For (Type=Software), there is 1 Down and 1 Up, Entropy(SSoftware)=1
For (Type=Hardware), there is 1 Down and 1 Up, Entropy(SHardware)=1
Compare all the gains:
Choose Competition as it has maximum gain.