Running examples in ‘mlr3tuning-Ex.R’ failed
The error most likely occurred in:

> ### Name: TuningInstanceSingleCrit
> ### Title: Single Criterion Tuning Instance
> ### Aliases: TuningInstanceSingleCrit
> 
> ### ** Examples
> 
> library(data.table)
> library(paradox)
> library(mlr3)
> 
> # Objects required to define the performance evaluator:
> task = tsk("iris")
> learner = lrn("classif.rpart")
> resampling = rsmp("holdout")
> measure = msr("classif.ce")
> param_set = ParamSet$new(list(
+   ParamDbl$new("cp", lower = 0.001, upper = 0.1),
+   ParamInt$new("minsplit", lower = 1, upper = 10))
+ )
> 
> terminator = trm("evals", n_evals = 5)
> inst = TuningInstanceSingleCrit$new(
+   task = task,
+   learner = learner,
+   resampling = resampling,
+   measure = measure,
+   search_space = param_set,
+   terminator = terminator
+ )
> 
> # first 4 points as cross product
> design = CJ(cp = c(0.05, 0.01), minsplit = c(5, 3))
> inst$eval_batch(design)
INFO  [04:17:18.427] [bbotk] Evaluating 4 configuration(s) 
INFO  [04:17:18.671] [mlr3]  Benchmark with 4 resampling iterations 
INFO  [04:17:18.695] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:17:18.736] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:17:18.780] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:17:18.871] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:17:18.922] [mlr3]  Finished benchmark 
INFO  [04:17:19.260] [bbotk] Result of batch 1: 
INFO  [04:17:19.265] [bbotk]    cp minsplit classif.ce                                uhash 
INFO  [04:17:19.265] [bbotk]  0.01        3       0.04 9460c67d-4c9b-4a80-946e-2062d30f90e7 
INFO  [04:17:19.265] [bbotk]  0.01        5       0.04 d30c07e7-b5b1-4711-9ae9-b6eae041080c 
INFO  [04:17:19.265] [bbotk]  0.05        3       0.04 a4ff0c72-d01f-456e-b343-ba3863f9d651 
INFO  [04:17:19.265] [bbotk]  0.05        5       0.04 ca84ed1c-a4bf-4610-844a-0cb044c902fc 
> inst$archive
<ArchiveTuning>
     cp minsplit classif.ce                                uhash  x_domain
1: 0.01        3       0.04 9460c67d-4c9b-4a80-946e-2062d30f90e7 <list[2]>
2: 0.01        5       0.04 d30c07e7-b5b1-4711-9ae9-b6eae041080c <list[2]>
3: 0.05        3       0.04 a4ff0c72-d01f-456e-b343-ba3863f9d651 <list[2]>
4: 0.05        5       0.04 ca84ed1c-a4bf-4610-844a-0cb044c902fc <list[2]>
             timestamp batch_nr
1: 2021-01-24 04:17:19        1
2: 2021-01-24 04:17:19        1
3: 2021-01-24 04:17:19        1
4: 2021-01-24 04:17:19        1
> 
> # try more points, catch the raised terminated message
> tryCatch(
+   inst$eval_batch(data.table(cp = 0.01, minsplit = 7)),
+   terminated_error = function(e) message(as.character(e))
+ )
INFO  [04:17:19.285] [bbotk] Evaluating 1 configuration(s) 
INFO  [04:17:19.424] [mlr3]  Benchmark with 1 resampling iterations 
INFO  [04:17:19.447] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:17:19.495] [mlr3]  Finished benchmark 
INFO  [04:17:19.651] [bbotk] Result of batch 2: 
INFO  [04:17:19.656] [bbotk]    cp minsplit classif.ce                                uhash 
INFO  [04:17:19.656] [bbotk]  0.01        7       0.04 3828a283-e752-4c8c-9ba4-ab755fbb1f6e 
> 
> # try another point although the budget is now exhausted
> # -> no extra evaluations
> tryCatch(
+   inst$eval_batch(data.table(cp = 0.01, minsplit = 9)),
+   terminated_error = function(e) message(as.character(e))
+ )
Error: Objective (obj:classif.rpart_on_iris, term:<TerminatorEvals>) terminated

> 
> inst$archive
<ArchiveTuning>
     cp minsplit classif.ce                                uhash  x_domain
1: 0.01        3       0.04 9460c67d-4c9b-4a80-946e-2062d30f90e7 <list[2]>
2: 0.01        5       0.04 d30c07e7-b5b1-4711-9ae9-b6eae041080c <list[2]>
3: 0.05        3       0.04 a4ff0c72-d01f-456e-b343-ba3863f9d651 <list[2]>
4: 0.05        5       0.04 ca84ed1c-a4bf-4610-844a-0cb044c902fc <list[2]>
5: 0.01        7       0.04 3828a283-e752-4c8c-9ba4-ab755fbb1f6e <list[2]>
             timestamp batch_nr
1: 2021-01-24 04:17:19        1
2: 2021-01-24 04:17:19        1
3: 2021-01-24 04:17:19        1
4: 2021-01-24 04:17:19        1
5: 2021-01-24 04:17:19        2
> 
> ### Error handling
> # get a learner which breaks with 50% probability
> # set encapsulation + fallback
> learner = lrn("classif.debug", error_train = 0.5)
> learner$encapsulate = c(train = "evaluate", predict = "evaluate")
> learner$fallback = lrn("classif.featureless")
> 
> param_set = ParamSet$new(list(
+   ParamDbl$new("x", lower = 0, upper = 1)
+ ))
> 
> inst = TuningInstanceSingleCrit$new(
+   task = tsk("wine"),
+   learner = learner,
+   resampling = rsmp("cv", folds = 3),
+   measure = msr("classif.ce"),
+   search_space = param_set,
+   terminator = trm("evals", n_evals = 5)
+ )
> 
> tryCatch(
+   inst$eval_batch(data.table(x = 1:5 / 5)),
+   terminated_error = function(e) message(as.character(e))
+ )
INFO  [04:17:19.969] [bbotk] Evaluating 5 configuration(s) 
INFO  [04:17:20.326] [mlr3]  Benchmark with 15 resampling iterations 
INFO  [04:17:20.350] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:17:20.460] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:17:20.563] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:17:20.629] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:17:20.708] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:17:20.794] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:17:20.868] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:17:20.943] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:17:21.015] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:17:21.110] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:17:21.209] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:17:21.278] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:17:21.355] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:17:21.482] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:17:21.554] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:17:21.732] [mlr3]  Finished benchmark 
INFO  [04:17:22.349] [bbotk] Result of batch 1: 
INFO  [04:17:22.355] [bbotk]    x classif.ce                                uhash 
INFO  [04:17:22.355] [bbotk]  0.2  0.6179849 2816b9e8-994d-4b9e-8552-a9e99ef41a89 
INFO  [04:17:22.355] [bbotk]  0.4  0.6179849 3d4e5d66-cc37-4975-bb76-3846cc69837b 
INFO  [04:17:22.355] [bbotk]  0.6  0.6575330 e9bf66ee-971f-4b86-b08d-773c9a95f522 
INFO  [04:17:22.355] [bbotk]  0.8  0.6682674 eb5e3d7d-3e84-4d60-b670-1c62ff2e07b4 
INFO  [04:17:22.355] [bbotk]  1.0  0.6179849 17d74274-2931-4a17-a4c2-7412362577be 
> 
> archive = inst$archive$data()
Error: attempt to apply non-function
Execution halted