Awesome Testing

Models · reviewed · reviewed Oct 16, 2026 · 3 min

How do decision trees and tree ensembles make predictions?

A decision tree applies learned feature tests until an input reaches a leaf containing a prediction. Random forests combine diverse trees; gradient boosting adds trees that improve a loss. These models predict from features without generating a language-model reasoning trace.

Follow one input to a leaf

A feature is an input value used for prediction. A split tests a feature and sends the input down one branch. A leaf supplies a class, class proportions, or a numeric prediction. Classification predicts a category; regression predicts a number.

Consider this authored support-routing tree. The thresholds and labels are teaching fixtures, not a fitted model or a production policy. Start at the top for a ticket affecting twelve users with no payment failure:

flowchart TD
  A{Affected users above 10?} -->|yes| B[Predict incident queue]
  A -->|no| C{Payment failure?}
  C -->|yes| D[Predict billing queue]
  C -->|no| E[Predict general support]

The ticket reaches the incident leaf. Changing the affected count from twelve to ten sends it through the payment test and into general support. The boundary is explicit: exactly ten does not satisfy “above 10.” The model result can suggest a queue; application code owns assignment and access checks.

Learning the tests differs from executing them

A handwritten routing diagram contains choices supplied by its author. A learned tree fits split features, thresholds and leaf predictions to labelled examples. A common classification objective favours splits that leave child groups less mixed by label. Regression instead reduces prediction error. Practical fitting is generally greedy: a locally useful split need not produce the globally best tree.

Once fitted, prediction traverses the stored tests. It does not retrain on the new ticket. In a basic classification tree, a leaf's class probability can be the fraction of training examples in that leaf belonging to the class. A pure leaf containing only a few examples can therefore look certain without supplying strong evidence about future tickets.

Depth limits, minimum leaf sizes and pruning constrain overfitting. A small change to training data can still change the fitted branches. An inspectable path explains which tests produced a prediction; it does not prove that those features caused the real-world outcome.

Combine trees in two different ways

An ensemble combines several models. The combination matters as much as the shape of one tree:

MethodHow trees are builtHow their outputs are combined
Single treeFit one hierarchy of splitsUse the reached leaf
Random forestFit trees with randomized data samples and feature choicesAggregate their predictions; scikit-learn classification averages class probabilities
Gradient boostingFit successive trees against a loss for the current ensembleAdd their contributions to the ensemble prediction

Random forests reduce variance by combining diverse trees whose errors need not coincide. Gradient boosting improves an additive prediction step by step. XGBoost is a scalable implementation of tree boosting with regularization and engineering for sparse data and efficient training; it is not a new name for a random forest.

Neither combination guarantees better predictions on every dataset. Compare held-out outcomes and operating cost. An ensemble also loses the simple explanation afforded by one short path.

A tree is one mechanism, not every structured decision

A learned tree works on the features it receives. Free-form language may require engineered features or a separate representation model. A System One model can instead judge a natural-language question about supplied state; a bounded result does not imply a tree inside it.

A search tree is different again: its nodes are alternative partial solutions created while solving a request. A decision tree stores a fitted prediction function. Changing a search budget explores more candidates; changing a prediction input follows another path through the fitted model.

For support routing, exact contractual rules can stay in code, learned predictions can handle patterns, and uncertain cases can reach a person. The model family does not choose which effects are allowed.

Sources and further reading

  1. 01
    Decision Treesscikit-learn · documentation · source checked Oct 16, 2026

    Fitted feature splits, leaf predictions and class frequencies, greedy training, instability and overfitting limits for individual trees.

  2. 02
    Ensembles: gradient boosting and random forestsscikit-learn · documentation · source checked Oct 16, 2026

    Distinguishes averaging randomized trees from successive additive boosting; documents probability averaging in scikit-learn forests.

  3. 03
    XGBoost: A Scalable Tree Boosting SystemChen and Guestrin · research · published Mar 9, 2016 · source checked Oct 16, 2026

    Primary tree-boosting objective and regularization with sparsity-aware and scalable implementation; distinct from random forests.