1 Parameter Tuning

In machine learning, models rely on hyperparameters that we need to tune before finalizing on a model. As this book will extensively use caret package, it’s important to understand a few key concepts pertaining to hyperparameter tuning that will help you use the package more efficiently.

caret enables parameter tuning through two arguments in the train() function — trControl and tuneGrid. We are supposed to pass a function trainControl() with its arguments to trControl while tuneGrid takes a data.frame object. Usually, we use expand.grid() function from base R to create the grid and pass it on to tuneGrid. Let’s understand each of these two arguments in more detail.