Cartesian grid search in caret
In chapter 1, you learned how to use the expand.grid()
function to manually define hyperparameters. The same function can also be used to define a grid of hyperparameters.
The voters_train_data
dataset has already been preprocessed to make it a bit smaller so training will run faster; it has now 80 observations and balanced classes and has been loaded for you. The caret
and tictoc
packages have also been loaded and the trainControl
object has been defined with repeated cross-validation:
fitControl <- trainControl(method = "repeatedcv",
number = 3,
repeats = 5)
Cet exercice fait partie du cours
Hyperparameter Tuning in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Define Cartesian grid
man_grid <- ___(degree = ___,
scale = ___,
C = ___)