title: Decision Tree using Gini index
body: <p>I'm trying to implement the decision tree algorithm based on the pseudo.</p>
  
  <p>However, I don't understand why the first node should be outlook.</p>
  
  <p>Shouldn't the gini index of Outlook be 1-(5/14)^2-(5/14)^2-(4/14)^2 = 0.663265306,
                 and gini index of Humidity be =1-(4/14)^2-(6/14)^2-(4/14)^2 = 0.653061224?</p>
  
  <p>As the gini index represents the impurity of the attribute, it is more reasonable to choose the attribute with the lower gini index.</p>
  
  <p>Is my way of finding a gini index is wrong or there is something else I should know?</p>
  
  <p>Data</p>
  
  <pre><code>Rainy   Hot High    FALSE   No
  Rainy   Hot High    TRUE    No
  Overcast    Hot High    FALSE   Yes
  Sunny   Mild    High    FALSE   Yes
  Sunny   Cool    Normal  FALSE   Yes
  Sunny   Cool    Normal  TRUE    No
  Overcast    Cool    Normal  TRUE    Yes
  Rainy   Mild    High    FALSE   No
  Rainy   Cool    Normal  FALSE   Yes
  Sunny   Mild    Normal  FALSE   Yes
  Rainy   Mild    Normal  TRUE    Yes
  Overcast    Mild    High    TRUE    Yes
  Overcast    Hot Normal  FALSE   Yes
  Sunny   Mild    High    TRUE    No
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/biydj.png" rel="nofollow">Here is the pseudo code of Decision Tree that I'm building</a></p>
  
  <p><a href="http://i.stack.imgur.com/lntft.png" rel="nofollow">Here is the answer</a></p>