I have a question regarding the Caret package to optimize the hyperparameters, such as random search for tuning the parameters of random forest. I run the following code but it gives better results based on the mtry parameter and the number of trees is not shown. My aim is to get the best values of both the mtry and n.tree, but it gives me just the value of mtry. The code is as follows:
control <- trainControl(method="repeatedcv", number=10, repeats=3, search="random")
rf_random <- train(Result ~ ., data=tr, method="rf",
metric=metric, tuneLength=15, trControl=control)
The result I get is when mtry=15, the best results is obtained. But why it does not give the best value for n.tree so that we later run the model based on the values obtained by random search.