Answers.Body: <p>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 <code>min_leaf_size</code> etc as well with this approach);</p>
  
  <p><strong>GridSearchCV</strong> You can specify a grid of all the hyperparameters and a scoring criteria. This function will then evaluate <strong>all</strong> combinations of these parameters for you and return the setting which performed best on the validation set.</p>
  
  <p><strong>RandomSearchCV</strong> You can specify a grid of all the hyperparameters and a scoring criteria. This function will then evaluate <strong>n randomly choosen</strong> combinations of these parameters for you and return the setting which performed best on the validation set.</p>
  
  <p><strong>Bayesian Optimization</strong> You can treat the hyperparameter settings and corresponding score as a black box function and use exploitation-exploration paradigm using bayesian optimization.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-09T08:39:18.940Z
Answers.LastActivityDate: 2018-11-09T08:39:18.940Z
Answers.UserDisplayName: jazib jamil
Body: <p>What are ways of determining the number of trees to be generated in a random forest algorithm?</p>
  
Tags: <machine-learning><decision-trees><hyper-parameters><random-forests>
Title: How many trees should be generated in a random forest?
UserDisplayName: Iram Shah
ThreadText: # How many trees should be generated in a random forest?
  
  (Asked by: username_0 on 2018-11-08)
  
  What are ways of determining the number of trees to be generated in a random forest algorithm?
  
  **Tags:** machine-learning, decision-trees, hyper-parameters, random-forests
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-11-09. Score: 1 | Accepted answer
  
  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);
  
  **GridSearchCV** You can specify a grid of all the hyperparameters and a scoring criteria. This function will then evaluate **all** combinations of these parameters for you and return the setting which performed best on the validation set.
  
  **RandomSearchCV** You can specify a grid of all the hyperparameters and a scoring criteria. This function will then evaluate **n randomly choosen** combinations of these parameters for you and return the setting which performed best on the validation set.
  
  **Bayesian Optimization** You can treat the hyperparameter settings and corresponding score as a black box function and use exploitation-exploration paradigm using bayesian optimization.
  
  
  ---
  
  