What are the main parameters of the random forest model?
Classic MLLevel: IntermediateRandom forest
What are the main parameters of the random forest model?
Hints
- How are training samples formed and how do ensemble trees differ?
- Consider correlation between model errors, not only individual quality.
Answer
For scikit-learn's random forest, n_estimators controls the number of trees. max_depth, min_samples_split, min_samples_leaf and max_leaf_nodes limit tree complexity. max_features controls how many candidate features are considered at each split, not one fixed feature subset for the entire tree.
bootstrap controls whether training rows are sampled with replacement; max_samples sets the bootstrap sample size when bootstrap is enabled. For classification, class_weight changes class weighting. random_state supports repeatable sampling and n_jobs controls parallel execution.
Tune complexity and feature sampling against validation performance. More trees often stabilize an ensemble but increase training time, memory and inference cost. Parameter availability and defaults depend on the library and version.
Source and licence: Alexey Grigorev & contributors — Data Science Interviews · CC-BY-4.0 · answer: Quantoros editorial