What do Gini impurity and entropy measure in a two-class decision-tree node, and what are their values when the positive-class proportion is (evenly mixed) and (pure)?
Supervised learning, Impurity measures
Level L1 Beginner. Length Short. Nature Th+Mat Both.
What's being asked
Whether you know what node impurity means and can evaluate Gini impurity and entropy for the two extreme cases: evenly mixed and completely pure.
Key idea
Impurity measures how mixed the class labels are in a node: it is for a pure node and largest when the classes are split . With as the fraction of positive samples, and .
Steps
- Explain impurity with an example: think of a basket of fruit. A basket holding only apples is pure (impurity ), whereas a basket that is half apples and half oranges is maximally mixed; a tree split tries to make its child nodes purer.
- At (most mixed): . Because , bit.
- At (pure): and bits (using the convention ). Since the node is pure, we stop splitting.
- Compare briefly: both curves rise smoothly from at a pure node to their peak at , so they usually choose very similar splits. Computing them on intermediate proportions to score candidate splits comes next.
Common mistakes
- Saying the maximum entropy is always 1. That holds for two classes only; with classes it is .
- Forgetting for a pure node.
- Thinking Gini is measured in bits. Gini has no unit.
How long your answer should be
4–5 sentences with the two quick calculations.
Read this
Previous in Supervised learning: How does Adaline (trained with the delta or LMS rule) differ from the perceptron, in the quantity used for the update and in the loss being minimised?
Next in Supervised learning: How many binary classifiers do one-vs-rest (OvR) and one-vs-one (OvO) need for classes? For classes , suppose the OvO classifiers say beats , beats , beats , beats , beats and beats . What does OvO predict, and why can OvR be ambiguous?