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.
| Step | What happens | Effect |
|---|---|---|
| Feature sampling | Pick K features at random at the node | Decorrelates trees |
| Random threshold | Draw one cut point per feature in its node range | Removes threshold search cost |
| Split scoring | Compare the K random splits by impurity | Keeps some predictive guidance |
| Recursion | Repeat until leaves are pure or minimal | Low-bias individual trees |
| Aggregation | Average outputs or take a majority vote | Cancels much of the variance |
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.
| Method | Training sample | Features per split | Threshold choice |
|---|---|---|---|
| Bagged trees | Bootstrap sample | All features | Optimal |
| Random forest | Bootstrap sample | Random subset | Optimal |
| Extra trees | Full data by default | Random subset | Random, best of K |
| Fully randomized trees | Full data | One random feature | Random |
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.
| Hyperparameter | Common default | Effect of increasing it |
|---|---|---|
| Number of trees | 100 to 500 | Lower variance, more memory and time |
| Max features (K) | Square root of features for classification | Less randomness, stronger individual trees |
| Minimum samples per leaf | 1 for classification, 1 to 5 for regression | Smoother predictions, higher bias |
| Maximum depth | Unlimited | More complex trees, larger model files |
| Bootstrap | Off | More diversity, enables out-of-bag error |
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.
| Situation | Recommendation | Reason |
|---|---|---|
| Many noisy features | Use extra trees | Random thresholds reduce variance |
| Large dataset, tight training budget | Use extra trees | No threshold sorting, parallel trees |
| Fast feature importance screening | Use extra trees | Quick, stable impurity-based ranking |
| Maximum accuracy on clean tabular data | Prefer gradient boosting | Sequential fitting reduces bias |
| Very small dataset | Compare with random forest | Random cuts can waste scarce data |
| Strict memory limit at inference | Limit depth or use another model | Fully grown trees are large |
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.