Fixing an Underfit Boosted-Tree Model: Which Knob to Loosen?
Machine LearningModel answerLast updated
Pick the one hyperparameter that, when lowered, makes a gradient-boosted tree ensemble more flexible, justify it, and describe how to confirm underfitting.
You have trained a gradient-boosted decision tree model and it is clearly underfitting: it performs poorly even on the data it was trained on.
You want to make the model more flexible by decreasing one hyperparameter. Consider these four candidates:
- Maximum tree depth
- Maximum number of leaves per tree
- The fraction of rows (observations) sampled to build each tree
- The minimum number of observations required in a leaf
Tasks
- Choose which one you would decrease to increase model capacity.
- Explain the mechanism: why does lowering it let the model fit the data more closely, and why do the other options not do the same (or do the opposite)?
- Describe how you would confirm that underfitting is really the problem, and how you would check that your change helped without simply trading it for overfitting.
Hints
Hint 1
For each candidate, ask: if I make this value smaller, does the tree become allowed to do more, or less? Only one of the four loosens a restriction when lowered.
Hint 2
Think about what a leaf-size floor forbids: splits that would isolate small groups of rows. What happens to the shape of the fitted function when such splits are forbidden?
Hint 3
To diagnose underfitting, compare training and validation error (learning curves). High error on both, with a small gap, points to high bias rather than high variance.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Answer
Decrease the minimum number of observations per leaf (often called min_child_samples, min_samples_leaf, or min_child_weight depending on the library).
Why this works
A gradient-boosted model is a sum of many shallow trees, each fit to the residual (negative gradient) of the current ensemble. Its flexibility is bounded by how fine a partition of the feature space each tree can create.
The minimum-leaf-size constraint says: a split is only allowed if both children keep at least m rows. This is a restriction, acting as regularization:
- A large m forbids splits that carve out small pockets of data. Sharp local structure, rare interactions and small subgroups cannot be represented, so the model is smoothed out and biased.
- Lowering m removes part of that restriction. Trees can isolate small groups, the partitions get finer, and the ensemble can track the residuals more closely. Bias goes down; variance goes up.
Why the other options are not the answer
- Max depth: this is an upper bound on complexity. Decreasing it shrinks the tree and makes underfitting worse. You would increase it.
- Max leaves: same logic. Fewer leaves means a coarser partition. You would increase it.
- Row subsampling fraction: lowering it means each tree sees less data. This injects randomness and acts as variance-reducing regularization (stochastic gradient boosting). It does not directly add capacity, and its effect on underfitting is at best indirect and uncertain; it usually helps generalization, not fit. If anything you would raise it toward 1.0 when underfitting.
So only the leaf-size floor is a constraint that becomes looser as the number goes down.
Confirming the diagnosis
- Compare training vs. validation error. Underfitting looks like high error on both, with a small gap. Overfitting looks like low training error and much higher validation error.
- Learning curves. Plot error against training set size and against number of boosting rounds. If both curves plateau at a high error and are close together, more data will not help; the model needs more capacity.
- Check against a baseline. If a simple model, or a deeper/larger model, does clearly better on the same split, the current one is capacity-limited.
Verifying the change
- Change one thing at a time. Sweep m over a grid (for example 50, 20, 10, 5, 1) with the other parameters fixed.
- Use a proper validation set or cross-validation (time-based splits if the data is temporal). Track both training and validation metrics.
- Success means training error falls and validation error falls or at least holds. If validation error starts rising while training error keeps dropping, you have crossed into overfitting; stop at the elbow.
- Use early stopping on the validation metric so the number of rounds does not hide the effect.
Trade-offs and practical notes
- Very small m (such as 1) lets leaves fit single noisy points, which is risky on noisy labels or small datasets. Counter this with a lower learning rate, L1/L2 leaf regularization, or row/column subsampling.
- Leaf-size floors interact with other settings. With a tiny max depth, lowering m may change little because depth is the binding constraint. If lowering m does not move the training error, check whether depth, leaf count, learning rate or number of rounds is the real bottleneck.
- Other levers for underfitting: increase depth or leaves, increase the number of boosting rounds, raise the learning rate, reduce L1/L2 penalties and minimum-gain-to-split thresholds, and improve features (interactions, better encodings). Feature quality is often the biggest win.
Common mistakes
- Reasoning that "smaller number means simpler model" for every parameter. The direction depends on whether the parameter is a cap or a floor.
- Treating row subsampling as a capacity knob.
- Tuning without looking at training error, which makes it impossible to tell bias from variance.
- Tuning on the test set, or changing several parameters at once so the cause of any improvement is unclear.