Classical ML, validation, metrics, interpretation, debugging · insight-1167
Set a minimum leaf size when tree-model probabilities feed a ranking or a threshold
- Evidence type
- documented fact
- Difficulty
- medium
- Roles
- Data scientist, ML engineer
- Industries
- aviation, banking
Summary: situation, action, reason, boundary
Situation
A single tree or a forest with fully grown leaves outputs probabilities that bunch at 0 and 1, and a review list or cut-off is built on them.
Action
Tune min_samples_leaf upward from about 5 using log loss or Brier score and precision at the review budget, not accuracy, and compare reliability curves before and after.
Reason
A tree's class probability is the class fraction in its leaf, so it is noisy when leaves are tiny; larger leaves average over more rows, and a forest averages tree probabilities again.
Boundary
Rare-event scoring and ranking with trees, random forests and extra-trees.
Symptom or risk
Leaves with few rows give fractions such as 1 of 1; cases tie at the extremes and the probabilities are overconfident.
Exceptions
For accuracy-only tasks with few classes, a leaf size of 1 is often the best choice.
Trade-offs
Larger leaves smooth away small but real pockets of risk and can lower recall for tiny segments.
Pitfalls
Tuning on accuracy, which barely moves, and concluding that leaf size does not matter.
Example
Hypothetical: a leaf with 2 no-shows out of 2 rows scores 1.0; a leaf with 14 out of 40 scores 0.35.
Lessons and concepts
Claims and their sources
A tree's predict_proba is the fraction of training samples of the class in the leaf; min_samples_leaf guarantees a minimum leaf size, 5 is suggested as a starting value, and for classification with few classes 1 is often best.
scikit-learn random forests average the probabilistic predictions of the individual trees rather than taking a vote.