Is there a way to disable the parameter tuning (grid) feature in CARET?

CARET will automatically use a pre-specified tuning grid to build various models before selecting a final model, and then training the final model on the full training data. I can supply my own tuning grid with only one combination of parameters. However even in this case, CARET “selects” the best model among the tuning parameters (even though there is only one in this case), and then fits the final model to all the training data. This is an extra step I’d like to avoid.

How do I simply skip the model search step across variations in the tuning grid and force CARET to build on all the training data (other than calling the underlying model library directly)?

Answer

You can specify method="none" in trainControl. For example:

train(Species ~ ., data=iris, method="rf", tuneGrid=data.frame(mtry=3),
  trControl=trainControl(method="none"))

I’m not sure when this was implemented.

Attribution
Source : Link , Question Author : Ram Ahluwalia , Answer Author : Peyton

Leave a Comment