Session Ready
Exercise

Perform hyperparameter tuning with mlr

Now, you can combine the prepared functions and objects from the previous exercise to actually perform hyperparameter tuning with random search. The knowledge_train_data dataset has already been loaded for you, as have the packages mlr, tidyverse and tictoc. And the following code has also been run already:

# Define task
task <- makeClassifTask(data = knowledge_train_data, 
                        target = "UNS")

# Define learner
lrn <- makeLearner("classif.nnet", predict.type = "prob", fix.factors.prediction = TRUE)

# Define set of parameters
param_set <- makeParamSet(
  makeDiscreteParam("size", values = c(2,3,5)),
  makeNumericParam("decay", lower = 0.0001, upper = 0.1)
)
Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Change the maximum number of iterations for random search to 6. Note, that 6 is a very low number; we use it so that calculation won't take forever to complete here; usually, you would set the number much higher (the default is 100).