Weighted average Gini impurity
Weighted average Gini impurity is the sample-size-weighted average of the Gini impurities of the subsets produced by a decision-tree split.
Statistics Every Programmer Needs
Weighted average Gini impurity is the observation-count-weighted impurity of the child groups produced by a decision-tree split.
- How it is used
- Selects decision-tree root and internal-node splits by comparing the class impurity produced by candidate features or thresholds.
- How deep it goes
- Explains separate child calculations and row-count weighting, but does not provide the full displayed equation.
- Examples
- Uses PLAY_TYPE class counts and the numeric TO_GO <= 3.5 threshold with observed CONVERT counts.
- What you can do after
- Apply it to calculate and compare candidate decision-tree splits for selecting node conditions.
Read how Statistics Every Programmer Needs explains weighted average Gini impurity →
Grokking Machine Learning
A split-quality measure equal to the size-weighted average of the Gini impurity indices of the resulting subsets.
- How it is used
- Ranks candidate decision-tree splits by how pure their resulting subsets are.
- How deep it goes
- Calculates impurity for concrete subsets and compares seven candidate cutoffs, without extending beyond the split-selection example.
- Examples
- Uses an app-recommendation dataset containing user ages and labels, with seven possible age-based splits.
- What you can do after
- Evaluate candidate decision-tree questions and select the split with the lowest weighted impurity in the demonstrated dataset.
Read how Grokking Machine Learning explains weighted average Gini impurity →
Related concepts
- splitmeasures · A decision-tree split is a rule that partitions observations at a node into subsets according to a feature and a condition on its value.
- decision treemeasures · A decision tree is a branching structure that represents sequential tests or choices, with paths leading to outcomes, predictions, or actions.
- Gini impuritypart of · Gini impurity is a measure of class-label heterogeneity in a set or decision-tree node, calculated from the proportions of its classes.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

