Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-1166

Guard tree-model inputs against values outside the training range, because predictions go flat instead of failing

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist, ML engineer
Industries
aviation, retail

Summary: situation, action, reason, boundary

  1. Situation

    A numeric feature at scoring time can exceed anything seen in training, such as a larger aircraft type or a new price tier.

  2. Action

    Store each numeric feature's training minimum and maximum with the model, flag scoring rows outside them, and send those to a fallback such as a linear baseline or a rule. If this is routine, fit a linear term first and boost the residual.

  3. Reason

    Tree predictions are piecewise constant, so a point beyond the last split lands in the edge leaf and inherits its value.

  4. Boundary

    Size, price, tenure and volume features that grow over time.

Symptom or risk

A tree or boosted model returns its outermost leaf's value, so the output stops responding to the feature yet looks plausible.

Exceptions

Features capped by design, such as a load factor that cannot exceed 1, need no range guard.

Trade-offs

A fallback adds a second model to maintain; residual boosting is only as good as the linear part.

Pitfalls

Checking each feature alone; a row can sit inside every marginal range and still be far from the training data.

Example

Hypothetical: a model trained on 120 to 189 seat aircraft scores a 300-seat widebody and returns what it learned for the 189-seat edge.

Lessons and concepts

Claims and their sources

  • Decision-tree predictions are piecewise constant approximations and trees are not good at extrapolation; a tree fitted on inputs 0 to 5 predicts the largest training target for an input of 10.

    Decision Trees (scikit-learn User Guide 1.10)