What is the mathematical difference between Gini impurity and entropy?

Quick Overview

Asks for the formulas of Gini impurity and entropy as decision tree split criteria and how the two relate mathematically. Tests whether you can connect them through an approximation, compare their scale and shape, and explain when the choice changes the chosen split.

What is the mathematical difference between Gini impurity and entropy?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Decision trees choose a split by minimizing the weighted impurity of the child nodes, and the two most common impurity measures are Gini impurity and entropy. What is the mathematical difference between Gini impurity and entropy? ```hint Common form Write each measure as $\sum_k p_k \, g(p_k)$ for some per-class penalty $g$, then compare the two penalties. ``` ```hint Where they differ Take the binary case and compare the two at the uniform distribution, then look at how steeply each one rises when a class proportion moves away from zero. ``` ### What a Strong Answer Covers - The exact formulas for Gini impurity and entropy in terms of the class proportions $p_k$ - How the two are related mathematically, including the approximation that connects them - The properties they share and why concavity matters for choosing splits - How they differ in scale, in shape near small proportions, in the loss each corresponds to, and in computation cost - Whether the choice changes the trees you get in practice ### Follow-up Questions - Why is misclassification error a poor split criterion, even though it is also zero for pure nodes and maximal at the uniform distribution? - For a binary node with class proportions 0.9 and 0.1, compute both measures and compare them after dividing each by its maximum. - How does the gain ratio used in C4.5 change entropy-based splitting on features with many distinct values? - Does the base of the logarithm in entropy affect which split is chosen?

Overview: Asks for the formulas of Gini impurity and entropy as decision tree split criteria and how the two relate mathematically. Tests whether you can connect them through an approximation, compare their scale and shape, and explain when the choice changes the chosen split.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Decision trees choose a split by minimizing the weighted impurity of the child nodes, and the two most common impurity measures are Gini impurity and entropy. What is the mathematical difference between Gini impurity and entropy?

What a Strong Answer Covers Guidance

  • The exact formulas for Gini impurity and entropy in terms of the class proportions pkp_k
  • How the two are related mathematically, including the approximation that connects them
  • The properties they share and why concavity matters for choosing splits
  • How they differ in scale, in shape near small proportions, in the loss each corresponds to, and in computation cost
  • Whether the choice changes the trees you get in practice

Follow-up Questions Guidance

  • Why is misclassification error a poor split criterion, even though it is also zero for pure nodes and maximal at the uniform distribution?
  • For a binary node with class proportions 0.9 and 0.1, compute both measures and compare them after dividing each by its maximum.
  • How does the gain ratio used in C4.5 change entropy-based splitting on features with many distinct values?
  • Does the base of the logarithm in entropy affect which split is chosen?