All lessons in Machine Learning Engineering: Reliable Predictive Models
Decision Trees and Weighted Impurity
Calculate a split gain and diagnose depth, leaf size, and unstable rules.
30 minutes · Members lesson · preview
What you will learn
- Calculate Gini impurity and a sample-weighted split improvement.
- Trace a parcel through a small decision tree and interpret its leaf probability.
- Explain how depth, leaf size and greedy splitting affect model behavior.
A linear score combines all features through one set of weights. A decision tree asks a sequence of questions, such as whether dispatch load exceeds a threshold and then whether weather risk is high. Different regions can have different predictions, so a tree can represent interactions without adding every interaction column explicitly.
The flexibility comes with a cost. Small changes in training data can change an early split and therefore many later decisions. A deep tree can isolate noisy records and report extreme training probabilities. Before averaging many trees into a forest, understand what one tree optimizes and what its output means.