library(mlr3verse)
# load terminator and set performance level
= trm("perf_reached", level = 0.25)
terminator
# load tuner
= tnr("random_search", batch_size = 10)
tuner
# retrieve task
= tsk("pima")
task
# load learner and set search space
= lts(lrn("classif.rpart"))
learner
# set instance
= ti(
instance task = task,
learner = learner,
resampling = rsmp("holdout"),
measure = msr("classif.ce"),
terminator = terminator
)
# hyperparameter tuning on the pima data set
$optimize(instance)
tuner
# best performing hyperparameter configuration
$result
instance
# fit final model on complete data set
$param_set$values = instance$result_learner_param_vals
learner$train(task)
learner
print(learner)
Terminators
Example Usage
Stop tuning when a performance level
is reached.