Runs a resampling (possibly in parallel).

resample(task, learner, resampling, ctrl = list())

Arguments

task

(Task): Object of type Task.

learner

(Learner): Object of type Learner.

resampling

(Resampling): Object of type Resampling.

ctrl

(named list(), e.g. as returned by mlr_control()): Object to control various parts of the execution. See mlr_control().

Value

ResampleResult.

Examples

task = mlr_tasks$get("iris") learner = mlr_learners$get("classif.rpart") resampling = mlr_resamplings$get("cv") rr = resample(task, learner, resampling) print(rr, digits = 2)
#> <ResampleResult> of learner 'iris' on task 'rpart' with 10 iterations #> Measure Min. 1st Qu. Median Mean 3rd Qu. Max. Sd #> mmce 0 0.067 0.067 0.073 0.12 0.13 0.049
rr$aggregated
#> mmce #> 0.07333333
rr$performance("mmce")
#> [1] 0.00000000 0.13333333 0.06666667 0.06666667 0.06666667 0.13333333 #> [7] 0.06666667 0.06666667 0.13333333 0.00000000
# Repeat resampling with featureless learner and combine # the ResampleResults into a BenchmarkResult learner = mlr_learners$get("classif.featureless") rr.featureless = resample(task, learner, resampling) bmr = rr$combine(rr.featureless) bmr$aggregated
#> hash resample_result task_id learner_id resampling_id #> 1: 85b74643783cc286 <ResampleResult> iris rpart cv #> 2: 8659e574511148b5 <ResampleResult> iris featureless cv #> mmce #> 1: 0.07333333 #> 2: 0.75333333