Question 86
What is the Gini Impurity of a dataset with 40 positive samples and 60 negative samples?
Original solution basis:
p+ = 0.4, p- = 0.6. Gini = 1 - (0.$4^2 + 0$.$6^2)$ = 1 - (0.16 + 0.36) = 1 - 0.52 = 0.48.
Deep Dive
The class probabilities are 0.4 and 0.6. Gini=1-(0.4²+0.6²)=1-(0.16+0.36)=0.48. The value is zero for a pure node and reaches 0.5 for a balanced binary node.Key Points to Remember:
• Gini=1-$\Sigma pᵢ²$.
• Use proportions, not raw counts, in the formula.
• For a binary node, Gini is at most 0.5.
Exam tip:
Keep full precision during intermediate calculations and round only at the final step, as requested.