Learn R Programming

mlr (version 2.3)

resample: Fit models according to a resampling strategy.

Description

The function resample fits a model specified by Learner on a Task and calculates predictions and performance measures for all training and all test sets specified by a either a resampling description (ResampleDesc) or resampling instance (ResampleInstance).

You are able to return all fitted models (parameter models) or extract specific parts of the models (parameter extract) as returning all of them completely might be memory intensive.

The remaining functions on this page are convenience wrappers for the various existing resampling strategies. Note that if you need to work with precomputed training and test splits (i.e., resampling instances), you have to stick with resample.

Usage

resample(learner, task, resampling, measures, weights = NULL,
  models = FALSE, extract, ..., show.info = getMlrOption("show.info"))

crossval(learner, task, iters = 10L, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

repcv(learner, task, folds = 10L, reps = 10L, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

holdout(learner, task, split = 2/3, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

subsample(learner, task, iters = 30, split = 2/3, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

bootstrapOOB(learner, task, iters = 30, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

bootstrapB632(learner, task, iters = 30, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

bootstrapB632plus(learner, task, iters = 30, stratify = FALSE, measures, models = FALSE, ..., show.info = getMlrOption("show.info"))

Arguments

Value

[ResampleResult]. List of:

See Also

Other resample: ResampleDesc, makeResampleDesc; ResampleInstance, makeResampleInstance; ResamplePrediction; ResampleResult

Examples

Run this code
task = makeClassifTask(data = iris, target = "Species")
rdesc = makeResampleDesc("CV", iters = 2)
r = resample(makeLearner("classif.qda"), task, rdesc)
print(r$aggr)
print(r$measures.test)
print(r$pred)

Run the code above in your browser using DataLab