Extra trees

Also known as: Extremely randomized trees

On this page 7

Extra trees, short for extremely randomized trees, is an ensemble learning method in machine learning that builds many decision trees and averages their predictions, choosing both the split feature and the split threshold at random instead of searching for the optimal cut. Proposed by Geurts, Ernst and Wehenkel in 2006, it is a close relative of the random forest that trades a small increase in bias for a larger reduction in variance and much faster training.

Extra trees handles both classification and regression, works well on tabular data with little tuning, and is available in standard libraries such as scikit-learn as ExtraTreesClassifier and ExtraTreesRegressor.

How extremely randomized trees choose their splits

At each node, an extra trees model draws a random subset of K features. For each of these features it draws one random threshold, uniformly between the minimum and maximum value of that feature in the node. It then scores the K candidate splits with an impurity criterion, such as Gini impurity or entropy for classification and variance reduction for regression, and keeps the best of them.

This differs from a classical CART tree, which evaluates every possible threshold for every candidate feature. Because extra trees tests only one threshold per feature, the expensive sorting step disappears, and each node is split in roughly linear time in the number of samples. The trees are grown fully or until a minimum leaf size is reached, without pruning.

By default, each tree is trained on the whole training set, not on a bootstrap sample. Diversity between trees comes from the random thresholds alone, which is sufficient because those thresholds already make the trees strongly decorrelated.

The table below summarizes the steps of building one tree.

StepWhat happensEffect
Feature samplingPick K features at random at the nodeDecorrelates trees
Random thresholdDraw one cut point per feature in its node rangeRemoves threshold search cost
Split scoringCompare the K random splits by impurityKeeps some predictive guidance
RecursionRepeat until leaves are pure or minimalLow-bias individual trees
AggregationAverage outputs or take a majority voteCancels much of the variance
Steps in growing one extremely randomized tree

Extra trees compared with random forest and bagging

Extra trees, random forest and bagging all average many deep trees, and they differ mainly in where the randomness comes from. Bagging randomizes the training data, random forest randomizes data and features, and extra trees randomizes features and thresholds.

MethodTraining sampleFeatures per splitThreshold choice
Bagged treesBootstrap sampleAll featuresOptimal
Random forestBootstrap sampleRandom subsetOptimal
Extra treesFull data by defaultRandom subsetRandom, best of K
Fully randomized treesFull dataOne random featureRandom
Sources of randomness in common tree ensembles

In terms of the bias-variance tradeoff, randomized thresholds make each tree slightly less accurate, so bias rises a little. Averaging across many such trees cancels much more of the variance, so the ensemble often matches or beats a random forest on noisy, high-dimensional data. On data where precise thresholds matter, a random forest or gradient boosting usually remains more accurate.

Unlike boosting, extra trees builds its trees independently and in parallel, so it scales across CPU cores and is resistant to overfitting as the number of trees grows.

Key hyperparameters and typical settings

Extra trees has few influential hyperparameters, and good defaults often work. The parameter K, called max_features in scikit-learn, controls the strength of randomization: a smaller K gives more random, more diverse trees.

HyperparameterCommon defaultEffect of increasing it
Number of trees100 to 500Lower variance, more memory and time
Max features (K)Square root of features for classificationLess randomness, stronger individual trees
Minimum samples per leaf1 for classification, 1 to 5 for regressionSmoother predictions, higher bias
Maximum depthUnlimitedMore complex trees, larger model files
BootstrapOffMore diversity, enables out-of-bag error
Main hyperparameters of extra trees

For regression, Geurts and colleagues recommended setting K equal to the total number of features, while scikit-learn now defaults to all features for regressors and the square root for classifiers. Because the full dataset is used, out-of-bag error is unavailable unless bootstrap sampling is enabled, so cross-validation is the usual way to evaluate the model.

When to choose extra trees

Extra trees is a strong choice when training speed and robustness matter more than squeezing out the last fraction of accuracy. The decision table below matches common situations with a recommendation.

SituationRecommendationReason
Many noisy featuresUse extra treesRandom thresholds reduce variance
Large dataset, tight training budgetUse extra treesNo threshold sorting, parallel trees
Fast feature importance screeningUse extra treesQuick, stable impurity-based ranking
Maximum accuracy on clean tabular dataPrefer gradient boostingSequential fitting reduces bias
Very small datasetCompare with random forestRandom cuts can waste scarce data
Strict memory limit at inferenceLimit depth or use another modelFully grown trees are large
Situations where extra trees fits or does not fit

Limitations and common mistakes

Extra trees shares the weaknesses of other tree ensembles and adds a few of its own. The most frequent issues seen in practice are listed below.

  • Large model size: fully grown trees on big datasets can occupy hundreds of megabytes, which slows loading and prediction.
  • Biased impurity importance: impurity-based feature importance favors features with many unique values; permutation importance gives a fairer picture.
  • No extrapolation: like all tree models, extra trees predicts constant values outside the range of the training data.
  • Sensitivity to irrelevant features with small K: when most features are noise, a very small K often picks only noise; raising K restores guidance.
  • Assuming bootstrap is on: users who expect out-of-bag scores must enable bootstrap explicitly.

Despite these limits, extra trees rarely overfits badly as more trees are added, and its smooth, piecewise-constant predictions often generalize better than those of a single deep decision tree.

In plain words

Imagine asking hundreds of people to sort fruit by size. Each person picks a rough cutoff at random, not the perfect one. Each person makes some mistakes. But their mistakes point in different directions.

When you combine all their answers, the errors mostly cancel out. Extra trees works the same way. It builds many quick, slightly careless decision trees and lets them vote. The result is fast to build and surprisingly reliable.

A real-world example

A utility company wants to predict hourly electricity demand for each substation from about 120 features, including weather readings, calendar effects and recent load values. The data science team has two million rows and needs to retrain the model every night within a 20-minute window.

A tuned random forest with 300 trees meets the accuracy target but takes about 35 minutes to train. An extra trees regressor with 300 trees and a minimum of three samples per leaf trains in roughly a third of that time on the same server and produces a very similar mean absolute error on held-out weeks. The team adopts extra trees for the nightly run and uses permutation importance monthly to confirm that temperature and the previous day’s load remain the dominant drivers.