Random Forest
An ensemble of many decision trees, each trained on a random subset of data and features — the forest votes (classification) or averages (regression) to get the final prediction.
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(n_estimators=100)
model.fit(X_train, y_train)
- Reduces overfitting compared to a single decision tree (variance reduction via averaging)
- Bagging — each tree sees a bootstrapped random sample of the training data
- Provides a built-in feature_importances_ ranking