Get startedGet started for free

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)

This exercise is part of the course

Hyperparameter Tuning in R

View Course

Exercise instructions

  • Set the following hyperparameters for a neural net: One hidden layer, maximum number of iterations of 150 and 0 decay.

Hands-on interactive exercise

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

# Set hyperparameters
lrn_best <- setHyperPars(lrn, par.vals = list(___ = 1, 
                                              ___ = 150, 
                                              ___ = 0))

# Train model
model_best <- train(lrn_best, task)
Edit and Run Code