Extra Trees and importance caveats
Quick answer
Extra Trees adds randomness to split thresholds, while standard random forests search candidate thresholds more systematically. Both are useful ensembles, but neither feature importance nor high accuracy alone establishes causation. Examples run locally with Python 3.13.5, scikit-learn 1.8.0, NumPy 2.3.5 and SciPy 1.17.0 when imported. ByteMind library execution is unverified.
Check Extra Trees sampling configuration
from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifierprint(ExtraTreesClassifier().bootstrap,RandomForestClassifier().bootstrap)m=ExtraTreesClassifier(n_estimators=8,random_state=7,n_jobs=1).fit([[0],[1],[2],[3]],[0,0,1,1])print(len(m.estimators_))Expected output:
False True8The default sampling choices differ; the small ensemble contains eight trees.
How it works
Extra Trees tests randomly generated candidate thresholds for selected features and chooses among those candidates. In the scikit-learn 1.8 ExtraTrees estimators, bootstrap defaults to False, unlike ordinary RandomForest estimators. Set it explicitly if you want a bootstrap comparison; OOB is only available with bootstrap enabled. Extra Trees can reduce split-search work and change the bias/variance trade-off, but actual speed and accuracy must be measured. Impurity-based importance accumulates weighted impurity reductions attributed to a feature, then normalizes when the total is positive. It may favor features with many possible splits and divide credit unpredictably among correlated variables. Permutation importance instead computes a baseline score on fixed evaluation rows, shuffles one column, and records the baseline score minus the new score. Repeat with several shuffles; negative values can arise from noise or harmful features. Correlated substitutes can make either feature appear individually unimportant, and shuffling may create unrealistic combinations. Use validation data for exploratory importance and do not select features on final test data. Neither importance measure is causal. Compare tree, forest and Extra Trees using the same fixed splits, several seeds, comparable budgets and measured prediction latency.
Inspect held-out permutation importance
from sklearn.tree import DecisionTreeClassifierfrom sklearn.inspection import permutation_importanceX=[[0,0],[0,1],[1,0],[1,1]]; y=[0,0,1,1]m=DecisionTreeClassifier(random_state=7).fit(X,y)V=[[0,2],[0,3],[1,2],[1,3]]; v=[0,0,1,1]r=permutation_importance(m,V,v,n_repeats=20,random_state=7,n_jobs=1)print(bool(r.importances_mean[0]>0),float(r.importances_mean[1]))Expected output:
True 0.0The unused noise feature has no effect in this deliberately simple held-out example.
Common mistakes
Do not claim Extra Trees always trains faster, or read impurity or permutation importance as an intervention effect. Do not repeatedly permute test data and then change the model.
Practice and next steps
Describe how two perfectly redundant features can hide each other in a permutation analysis. Propose a validation-only joint permutation as a diagnostic. Complete the knowledge check and coding exercise. Next: Additive weak learners.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Extra Trees and importance caveats — knowledge check
Apply extra trees and importance caveats to new examples.
Which default differs in scikit-learn 1.8?
How is a permutation score drop defined for accuracy?
What can a negative importance mean?
What can correlated features do to individual importance?
Where should exploratory importance guide feature selection?