Assignment 4.solution
Assignment 4.solution
Consider a data set (take a reasonable number of observations) from the literature or research
papers or some other source to construct a Decision Tree using the ID3 algorithm.
Use well the Entropy and Information Gain to perform the calculations...
Following medical diagnostic data, I will solve for decision tree by using ID3 algorithm.
Entropy E(A)=
Proper gain (A)=I p1(n)-E(A)
Steep throat=3
Allergy=3
Cold=4
=-[-0.521-0.521-0.529]
=1.571
For entropy first we will find information gain of yes and no.
=1.52
=1.52
=5/10*1.52 + 5/10*1.52
= 0.5*1.52+0.5*1.52
=0.76+076
=1.52
ST A C
yes 1 0 3
No 2 3 1
I have to find entropy of Fever.
For finding entropy I have to need Information gain of (yes) and Information gain of (No).
=0.811
=-[-1.45]
=1.45
=0.32+ 0.87
=1.19
=1.571-1.19
=0.38
ST A A
yes 3 0 0
No 0 3 4
=0
=- [- 0.53-0.46]
= 0.99
= 0.69
(iv) Congestion
ST A C
Yes 1 3 4
No 2 0 0
Entropy of congestion=
(iv) Headache
ST A C
Yes 1 2 2
No 2 1 2
Now I have to calculate Entropy of headache.
Attribute Gain
Sore throat 0.05
fever 0.38
Swollen glands 0.88
Congestion 0.44
Headache 0.05