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:55:23.910] [bbotk] Evaluating 4 configuration(s) 
INFO  [04:55:24.355] [mlr3]  Benchmark with 4 resampling iterations 
INFO  [04:55:24.380] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:55:24.422] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:55:24.505] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:55:24.588] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:55:24.694] [mlr3]  Finished benchmark 
INFO  [04:55:25.264] [bbotk] Result of batch 1: 
INFO  [04:55:25.269] [bbotk]    cp minsplit classif.ce                                uhash 
INFO  [04:55:25.269] [bbotk]  0.01        3       0.04 97398879-c294-4d7a-bf63-7b62b7c11420 
INFO  [04:55:25.269] [bbotk]  0.01        5       0.04 d75eb6c1-cde4-489b-9535-635d2920c5ca 
INFO  [04:55:25.269] [bbotk]  0.05        3       0.04 4a7e9dd9-0a7d-4065-ac4b-b7889eafa2a0 
INFO  [04:55:25.269] [bbotk]  0.05        5       0.04 b29d3d30-9b35-4847-94fe-26011f8e96f0 
> inst$archive
<ArchiveTuning>
     cp minsplit classif.ce                                uhash  x_domain
1: 0.01        3       0.04 97398879-c294-4d7a-bf63-7b62b7c11420 <list[2]>
2: 0.01        5       0.04 d75eb6c1-cde4-489b-9535-635d2920c5ca <list[2]>
3: 0.05        3       0.04 4a7e9dd9-0a7d-4065-ac4b-b7889eafa2a0 <list[2]>
4: 0.05        5       0.04 b29d3d30-9b35-4847-94fe-26011f8e96f0 <list[2]>
             timestamp batch_nr
1: 2021-01-24 04:55:25        1
2: 2021-01-24 04:55:25        1
3: 2021-01-24 04:55:25        1
4: 2021-01-24 04:55:25        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:55:25.276] [bbotk] Evaluating 1 configuration(s) 
INFO  [04:55:25.353] [mlr3]  Benchmark with 1 resampling iterations 
INFO  [04:55:25.377] [mlr3]  Applying learner 'classif.rpart' on task 'iris' (iter 1/1) 
INFO  [04:55:25.417] [mlr3]  Finished benchmark 
INFO  [04:55:25.558] [bbotk] Result of batch 2: 
INFO  [04:55:25.564] [bbotk]    cp minsplit classif.ce                                uhash 
INFO  [04:55:25.564] [bbotk]  0.01        7       0.04 0f00584c-6049-4b96-b8f9-3e5a6d014625 
> 
> # 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 97398879-c294-4d7a-bf63-7b62b7c11420 <list[2]>
2: 0.01        5       0.04 d75eb6c1-cde4-489b-9535-635d2920c5ca <list[2]>
3: 0.05        3       0.04 4a7e9dd9-0a7d-4065-ac4b-b7889eafa2a0 <list[2]>
4: 0.05        5       0.04 b29d3d30-9b35-4847-94fe-26011f8e96f0 <list[2]>
5: 0.01        7       0.04 0f00584c-6049-4b96-b8f9-3e5a6d014625 <list[2]>
             timestamp batch_nr
1: 2021-01-24 04:55:25        1
2: 2021-01-24 04:55:25        1
3: 2021-01-24 04:55:25        1
4: 2021-01-24 04:55:25        1
5: 2021-01-24 04:55:25        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:55:25.972] [bbotk] Evaluating 5 configuration(s) 
INFO  [04:55:26.523] [mlr3]  Benchmark with 15 resampling iterations 
INFO  [04:55:26.573] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:55:26.740] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:55:26.885] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:55:26.947] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:55:27.063] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:55:27.183] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:55:27.255] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:55:27.320] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:55:27.444] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:55:27.553] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:55:27.623] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:55:27.757] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:55:27.843] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 1/3) 
INFO  [04:55:27.937] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 2/3) 
INFO  [04:55:28.062] [mlr3]  Applying learner 'classif.debug' on task 'wine' (iter 3/3) 
INFO  [04:55:28.210] [mlr3]  Finished benchmark 
INFO  [04:55:28.982] [bbotk] Result of batch 1: 
INFO  [04:55:28.987] [bbotk]    x classif.ce                                uhash 
INFO  [04:55:28.987] [bbotk]  0.2  0.6179849 2e9aa0e4-df5f-4c85-b982-0cb85012aa99 
INFO  [04:55:28.987] [bbotk]  0.4  0.6179849 0f9ef19a-fd63-43c8-bb05-b6e65e7b3d26 
INFO  [04:55:28.987] [bbotk]  0.6  0.6575330 a6f072f4-c5b8-47ef-b20a-8cb51bd89f8c 
INFO  [04:55:28.987] [bbotk]  0.8  0.6682674 5efd6be8-e914-4a38-a663-7e8440a5b9cb 
INFO  [04:55:28.987] [bbotk]  1.0  0.6179849 de5bdef1-6021-42e1-a775-7f8b07c30746 
> 
> archive = inst$archive$data()
Error: attempt to apply non-function
Execution halted