Skip to main content
Albero Academy

Trees & Forests

Tree-based classifiers — interpretable and powerful.

Classification8 min

The tree family works for classification too. A decision tree classifier asks a series of yes/no questions to reach a label; ensembles of trees are among the strongest, most popular models for tabular classification.

The classification tree family

tree → forest → boosting
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
DecisionTreeClassifier(max_depth=4) # interpretable rules
RandomForestClassifier(n_estimators=200) # robust, strong default
GradientBoostingClassifier() # often top accuracy

Key takeaways

  1. 01Decision tree classifiers reach a label via a series of yes/no splits.
  2. 02RandomForestClassifier is a strong, robust default — no scaling needed.
  3. 03Gradient boosting often gives the best tabular accuracy.
  4. 04feature_importances_ shows which features drive predictions.

Finished this chapter?

Mark it complete to track your progress through Scikit-learn.