Get startedGet started for free

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)
)

This exercise is part of the course

Hyperparameter Tuning in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define a random search tuning method.
ctrl_random <- makeTuneControlRandom(___ = ___)
Edit and Run Code