liveBook · Manning

Gini impurity

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Gini impurity is the probability of misclassifying an element labeled according to the class distribution of its subset.

Gini impurity measures how likely a randomly selected item would be misclassified if it received a label drawn from its subset’s class distribution. A pure subset has one class; a mixed subset has greater impurity. section 5.1

A classification tree uses Gini impurity to compare candidate feature splits. It prefers splits whose resulting subsets are more homogeneous, typically combining the child impurities with their subset sizes. section 5.1

Choosing a split efficiently

For an Airbnb price-range classification task, latitude offers many possible thresholds. Testing every unique latitude took about 46.9 seconds; evaluating 256 histogram-bin thresholds produced the same selected split and score in about 562 milliseconds. section 5.4.3

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines the misclassification probability and demonstrates threshold scoring, but stops short of a mathematical derivation.
Examples
Uses Airbnb price-range prediction, latitude thresholds, exhaustive candidate search, and 256-bin histogram candidates.
What it assumes
Assumes classification labels and decision-tree splitting, while explaining impurity in plain probabilistic terms.
What you can do after
Build a split-scoring routine from scratch and compare exhaustive threshold search with histogram-based candidates.
How it connects
Connects Gini impurity with decision trees, entropy, information gain, classification, and histogram splitting.

Also explained in

Compare how 5 books explain Gini impurity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.