Daffodil International University

Faculty of Science and Information Technology => Software Engineering => Topic started by: Asif Khan Shakir on July 06, 2019, 02:32:59 AM

Title: How to determine the number of trees to be generated in Random Forest algorithm?
Post by: Asif Khan Shakir on July 06, 2019, 02:32:59 AM
In general, the more trees you use the better get the results. However, the improvement decreases as the number of trees increases, i.e. at a certain point the benefit in prediction performance from learning more trees will be lower than the cost in computation time for learning these additional trees.
Random forests are ensemble methods, and you average over many trees. Similarly, if you want to estimate an average of a real-valued random variable (e.g. the average heigth of a citizen in your country) you can take a sample. The expected variance will decrease as the square root of the sample size, and at a certain point the cost of collecting a larger sample will be higher than the benefit in accuracy obtained from such larger sample.
In your case you observe that in a single experiment on a single test set a forest of 10 trees performs better than a forest of 500 trees. This may be due to statistical variance. If this would happen systematically, I would hypothesize that there is something wrong with the implementation.
Typical values for the number of trees is 10, 30 or 100. I think in only very few practical cases more than 300 trees outweights the cost of learning them (well, except maybe if you have a really huge dataset).
Title: Re: How to determine the number of trees to be generated in Random Forest algorithm?
Post by: lamisha on July 08, 2019, 01:47:28 AM
thanks for sharing