Setting hyperparameters
And finally, you are going to set specific hyperparameters, which you might have found by examining your tuning results from before,
The knowledge_train_data
dataset has already been loaded for you, as have the packages mlr
and tidyverse
. And the following code has also been run:
task <- makeClassifTask(data = knowledge_train_data,
target = "UNS")
lrn <- makeLearner(cl = "classif.nnet", fix.factors.prediction = TRUE)
Cet exercice fait partie du cours
Hyperparameter Tuning in R
Instructions
- Set the following hyperparameters for a neural net: One hidden layer, maximum number of iterations of 150 and 0 decay.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Set hyperparameters
lrn_best <- setHyperPars(lrn, par.vals = list(___ = 1,
___ = 150,
___ = 0))
# Train model
model_best <- train(lrn_best, task)