When a decision-tree question divides data into subsets, weighted average Gini impurity measures how mixed the resulting groups are. It averages each subset’s Gini impurity according to that subset’s size, so lower values indicate cleaner splits. section 9.3
Splitting app users by age
The cutoff 14.5 creates {A, A}, which is pure and has Gini impurity 0, and {A, C, B, C}, whose label proportions are 1/4, 1/4, and 1/2. Combining these impurities by subset size gives a weighted index of 0.417. The cutoff 20 is better in this dataset: it has the lowest weighted index, 0.222, and the highest accuracy, 5/6. section 9.3

