Resamplings

Resampling Strategies of the mlr3 ecosystem.

Resamplings split the observations multiple times into two sets: training and test. The former is used to fit the model, the latter is used to evaluate the predictions. The Resampling objects provide an abstraction for this procedure while respecting stratification as well as grouping/blocking if this is required by the Task.

If only a single split is required (i.e., a holdout split), the partition() function provides a single split into training and test set.

Example Usage

Fit a Random Forest on the Wisconsin Breast Cancer Data Set using a 3-fold cross validation.

library("mlr3verse")

# retrieve the task
task = tsk("breast_cancer")

# retrieve a learner
learner = lrn("classif.ranger")

# retrieve resampling strategy
resampling = rsmp("cv", folds = 3)

# perform resampling
rr = resample(task, learner, resampling)
rr
<ResampleResult> of 3 iterations
* Task: breast_cancer
* Learner: classif.ranger
* Warnings: 0 in 0 iterations
* Errors: 0 in 0 iterations