Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
36 views4 pages

Assignment-2 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

Assignment-2 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment-2 Solution

𝑎 𝑎 𝑏 𝑏
𝐼𝑛𝑓𝑜ሺ𝑎, 𝑏ሻ = − log 2 ቀ ቁ− log 2 ൬ ൰
𝑎+𝑏 𝑎+𝑏 𝑎+𝑏 𝑎+𝑏
8 4 4 4 4 6 5 5 1 1
𝐼𝑛𝑓𝑜ℎ𝑢𝑚𝑖𝑑𝑖𝑡𝑦 ሺ𝐷ሻ = ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ + ሺ− log 2 ሺ ሻ − log 2 ሺ ሻሻ
14 8 8 8 8 14 6 6 6 6
= 0.85

Gain(humidity) = 0.9402-.85 = 0.0902


8 6 6 2 2 6 3 3 3 3
𝐼𝑛𝑓𝑜𝑤𝑖𝑛𝑑 ሺ𝐷ሻ = ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ + ሺ− log 2 ሺ ሻ − log 2 ሺ ሻሻ
14 8 8 8 8 14 6 6 6 6
= 0.8922

Gain(wind) = 0.9402-.8922 = 0.048

2 2 3 3
Info(D1) = − 5 log 2 5 − 5 log 2 5 = 0.97095
2 2 2 2 1 1 1 1 1 1 1
𝐼𝑛𝑓𝑜𝑡𝑒𝑚𝑝 ሺ𝐷1ሻ = ቀ− 2 log 2 ሺ2ሻቁ + ቀ− 2 log 2 ሺ2ሻ − 2 log 2 ሺ2ሻቁ + 5 ቀ− 1 log 2 ሺ1ሻቁ = 0.4
5 5

Gain(temp) = 0.97095-0.4 = 0.57095


3 3 3 2 2 2
𝐼𝑛𝑓𝑜ℎ𝑢𝑚 ሺ𝐷1ሻ = ൬− log 2 ሺ ሻ൰ + ൬− log 2 ሺ ሻ൰ = 0
5 3 3 5 2 2
Gain(hum) = 0.97095-0 = 0.97095
3 2 2 1 1 2 1 1 1 1
𝐼𝑛𝑓𝑜𝑤𝑖𝑛𝑑 ሺ𝐷1ሻ = ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ + ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ = 0.95098
5 3 3 3 3 5 2 2 2 2
Gain(wind) = 0.97095-0.95098 = 0.01995

3 3 2 2
Info(D1) = − 5 log 2 5 − 5 log 2 5 = 0.97095

3 2 2 1 1 2 1 1 1 1
𝐼𝑛𝑓𝑜𝑡𝑒𝑚𝑝 ሺ𝐷2ሻ = ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ + ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ = 0.95098
5 3 3 3 3 5 2 2 2 2
Gain(temp) = 0.97095-0.95098 = 0.01997
2 1 1 1 1 3 2 2 1 1
𝐼𝑛𝑓𝑜ℎ𝑢𝑚 ሺ𝐷2ሻ = ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ + ൬− log 2 ሺ ሻ − log 2 ሺ ሻ൰ = 0.95098
5 2 2 2 2 5 3 3 3 3
Gain(hum) = 0.97095-0.95098 = 0.01997
3 3 3 2 2 2
𝐼𝑛𝑓𝑜𝑤𝑖𝑛𝑑 ሺ𝐷2ሻ = ൬− log 2 ሺ ሻ൰ + ൬− log 2 ሺ ሻ൰ = 0
5 3 3 5 2 2
Gain(wind) = 0.97095-0 = 0.97095
So the right node should be splitted over wind

You might also like