# How to select the split point for Continuous Attribute Age

For the above table, midpoints for possible split points are 22.5 and 35. I have calculated the entropy and gain for each value and 35 had the minimum Entropy and highest gain. Is it correct ?

Given High -> (-), and Low -> (+)

D<22.5 => [0+, 2-], Entropy (D<22.5) = 0, since all the values are of the same class High.

D>22.5 => [2+, 2-], Entropy (D>22.5) = 1, since the values are distributed equally among Low and High classes.

D<35 => [2+, 3-], Entropy (D<35) = -[2/6 x $$log_2$$(2/6) + 3/6 x $$log_2$$⁡(3/6)]= 0.5

D>35 => [0+, 1-], Entropy (D>35) = 0, since all the values are of the same class High

Gain (D, Age>22.5) = 0.918 - 2/6 (0) - 4/6 (1) = 0.2513

Gain (D, Age>35) = 0.918 - 5/6 (0.5) - 1/6 (0) = 0.5103

Is that right?

## 1 Answer

For 35 split, there is an error in the denominator. It should be 5 as the total number of items for D<35 is 5

D<35 => [2+, 3-], Entropy (D<35) = -[2/5 x $$log_2$$(2/5) + 3/5 x $$log_2$$⁡(3/5)]

• Thank you jdsuryap , this was helpful. Is correct to say that though the Entropy of D<22.5 is higher than Entropy of D<35; however the gain for D<22.5 is higher. – Ali Apr 13 at 15:49
• Perhaps not @Ali. If you would try fixing the error as I proposed, the correct entropy of 35 split is higher. Hence, the information gain for split 22.5 is higher. – jdsuryap Apr 13 at 17:56
• Thank you. I did already. Entropy (D<35) = -[2/5 x 〖log_2 (〗⁡〖2/5)〗+3/5 x 〖log_2 (〗⁡〖3/5)〗 ]= 0.9709 D<35  [2+, 3-] . So the Entropy of 22.5 is 1 and Entropy of 35 is 09709 however the gain for 22.5 will be higher though its entropy is lower. – Ali Apr 15 at 6:33