Decision Tree
Decision Tree
If all the elements belong to a single class, then it can be called pure.
Gini Index
The Gini Index or Gini Impurity is calculated by subtracting the sum of the squared
probabilities of each class from one
If all the elements belong to a single class, then it can be called pure.
'0' denotes that all elements belong to a certain class or there exists only one class
(pure)
'1' denotes that the elements are randomly distributed across various classes
(impure).
C
Gini 1 pi2
i 1
The degree of Gini Index varies between 0 and 1,
While building the decision tree , we would prefer to choose the attribute/feature with
the least Gini Index as the root node.