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
from sklearn.tree import DecisionTreeClassifierfrom sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifierDecisionTreeClassifier(max_depth=4) # interpretable rulesRandomForestClassifier(n_estimators=200) # robust, strong defaultGradientBoostingClassifier() # often top accuracy
Key takeaways
- 01Decision tree classifiers reach a label via a series of yes/no splits.
- 02RandomForestClassifier is a strong, robust default — no scaling needed.
- 03Gradient boosting often gives the best tabular accuracy.
- 04feature_importances_ shows which features drive predictions.
