The metric that the decision tree uses to decide if the root node is called the Gini coefficient. The higher the value of this coefficient, the better the job that this particular feature does at splitting the data into distinct groups. In order to learn how to compute the Gini coefficient for a feature, let's consider the following diagram:
In the preceding diagram, the following happens:
- The feature splits the data into two groups.
- In the left-hand group, we have two triangles and one circle.
- Therefore, the Gini for the left-hand group is (2 triangles/3 total data points)^2+ (1 circle/3 ...