# How the number of trees to be generated in Random Forest algorithm?

The default number of trees to be generated is 10. But I thought it should be a very large number and I put 500 trees. However it performed better when the number of trees are 10 than 500. My question is How to determine the number of trees to be generated in Random Forest algorithm?

The number of estimators in Random Forest is a hyper-parameter. If you are using SKLearn's Random Classifier you can use one of the following techniques to find a (near) optimal hyperparameter settings (Note:You can tweak other hyperparameters like min_leaf_size etc as well with this approach);