How do we know how many trees we need in random forest?
Classic MLLevel: IntermediateRandom forest
How do we know how many trees we need in random forest?
Hints
- How are training samples formed and how do ensemble trees differ?
- Consider correlation between model errors, not only individual quality.
Answer
The number of trees in random forest is worked by n_estimators, and a random forest reduces overfitting by increasing the number of trees. There is no fixed thumb rule to decide the number of trees in a random forest, it is rather fine tuned with the data, typically starting off by taking the square of the number of features (n) present in the data followed by tuning until we get the optimal results.
Source and licence: Alexey Grigorev & contributors — Data Science Interviews · CC-BY-4.0