The bagging recipe
A random forest grows many decision trees on bootstrap samples, each tree splitting on a random subset of features. Predictions are averaged (regression) or voted (classification). Bagging reduces variance dramatically while keeping bias roughly the same as a single tree. Random feature subsetting decorrelates the trees so the variance reduction is real.
What to tune (and what not to)
- n_estimators — more is usually better until you run out of compute. Diminishing returns past a few hundred.
- max_features — sqrt for classification, 1/3 for regression are sane defaults.
- max_depth, min_samples_leaf — control individual tree complexity; defaults work surprisingly often.
- Out-of-bag (OOB) score — free estimate of generalization; turn it on with
oob_score=True.
When to reach for it
Random forests are the "just works" tabular baseline above logistic regression. Use them when you want strong out-of-the-box performance with minimal tuning and you can tolerate slightly larger memory footprints. For the very top of the leaderboard, gradient boosting usually edges them out.