0
$\begingroup$

I did a grid search at random forest params. the result of

print(randomforestreg.best_params_)

The result is = {'max_depth': 28, 'n_estimators': 500 ',max_features': 'sqrt', 'min_samples_split': 2, 'min_samples_leaf': 1'}

The Random Forest documentation: If “auto”, then max_features=sqrt(n_features). If “sqrt”, then max_features=sqrt(n_features) (same as “auto”).

So 'sqrt' is like max_features=sqrt(n_features) --> same as 'auto'. --> the number of features with which tree is build. I dont understand this. When I have 19 columns(features) and 100.000 rows, what is now the answer of the question; "what is the best value for max_features?". Is it the squared value of n features = 19^2 = 361?

$\endgroup$
1
  • $\begingroup$ "sqrt" is a standard abbreviation of "square root" $\endgroup$ Oct 5 '20 at 1:01
1
$\begingroup$

The way to understand Max features is "Number of features allowed to make the best split while building the tree". The reason to use this hyperparameter is, if you allow all the features for each split you are going to end up exactly the same trees in the entire random forest which might not be useful. To overcome this we let the model select a fixed number of features randomly, in this case, the no of features allowed = Square root of total no of features in your dataset.

Hope this clears up !!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.