I am using Random Forest with caret package to set the best mtry (number of prediction factors). When I plot the model to the see the variation of the RMSE with the mtry, I want to add a point into the best mtry
ctrl <- trainControl(method = "cv", savePred=T, number = 10)
tunegrid <- expand.grid(.mtry=seq(from=2,to=nlayers(covs_processed),by=2))
# Search for the best mtry parameter
rfmodel <- train(fm, data=dat_1963@data, method = "rf", trControl = ctrl,
importance=TRUE, tuneGrid=tunegrid)
plot(rfmodel,main= "Tuning RF 2018")
Position point:
rfmodel[11][[1]]$tuneValue[[1]]
24
min(rfmodel$results$RMSE)
2.972381
I tried adding the point with this code but I could
points(rfmodel[11][[1]]$tuneValue[[1]],min(rfmodel$results$RMSE),col="red")
The model can be found here: https://drive.google.com/open?id=1tFFgxuCiJNC4PLMekBG7bgEziKGwMJmu