How are predictions aggregated across trees in a Random Forest regressor?

Last updated 5 November 2026

A Random Forest regressor predicts the arithmetic mean of the individual trees' predictions. Each tree outputs the average target value of the leaf the sample lands in, and the forest averages those outputs.

  • Per-tree prediction: The sample is routed down the tree to a leaf. The leaf's value is the mean of the training targets in it (with the default squared-error criterion).

  • Forest prediction:

    • The forest computes ŷ = (1/B) Σ ŷ_b over all B trees, with equal weight per tree.

    • In scikit-learn, RandomForestRegressor.predict is exactly this mean.

  • Why averaging helps: Averaging many high-variance, low-bias trees reduces variance. The reduction is largest when trees are weakly correlated.

  • Consequences:

    • Predictions are always within the range of the training targets, so the forest cannot extrapolate.

    • The spread of the per-tree predictions gives a rough uncertainty signal. Quantile regression forests go further and keep the full leaf distributions to estimate quantiles instead of just the mean.

[lang:python] import numpy as np per_tree = np.stack([t.predict(X) for t in rf.estimators_]) assert np.allclose(per_tree.mean(axis=0), rf.predict(X))

  • https://medium.com/@coder_cat/nail-your-data-science-interview-day-3-decision-trees-random-forests-6aaf9c4352da
  • https://github.com/Devinterview-io/random-forest-interview-questions
  • https://pub.towardsai.net/top-20-random-forest-interview-questions-answers-17e8738abfbc
All Random Forests interview questions