What does the Gini impurity of a decision-tree node measure?
Show the answer and explanation
Correct answer: A, The chance a random sample from the node is mislabelled if labels are drawn from the node's class mix.
Explanation Decision Trees
Gini impurity of a node with class proportions p₁ … p_K is
Gini = 1 − Σ p_k² = Σ p_k(1 − p_k)
It is the probability that a randomly drawn sample is misclassified when it is given a random label drawn from the node's own class distribution. It is 0 for a pure node and grows as the classes become more mixed.
Why the other descriptions are wrong:
- The Gini coefficient of income inequality is a different quantity; tree impurity is computed from class labels, not feature values.
- The majority-class share is a purity measure (1 minus the misclassification error); Gini impurity moves in the opposite direction, higher means less pure.
- The expected number of bits to encode the label is entropy, the other common split criterion.
Interview tip: give the formula 1 − Σ p² and the two anchors: 0 for a pure node, 0.5 for a 50/50 binary node.