Learn R Programming

mlr (version 2.15.0)

getResamplingIndices: Get the resampling indices from a tuning or feature selection wrapper..

Description

After you resampled a tuning or feature selection wrapper (see makeTuneWrapper) with resample(..., extract = getTuneResult) or resample(..., extract = getFeatSelResult) this helper returns a list with the resampling indices used for the respective method.

Usage

getResamplingIndices(object, inner = FALSE)

Arguments

object

(ResampleResult) The result of resampling of a tuning or feature selection wrapper.

inner

(logical) If TRUE, returns the inner indices of a nested resampling setting.

Value

(list). One list for each outer resampling fold.

See Also

Other tune: TuneControl, getNestedTuneResultsOptPathDf, getNestedTuneResultsX, getTuneResult, makeModelMultiplexerParamSet, makeModelMultiplexer, makeTuneControlCMAES, makeTuneControlDesign, makeTuneControlGenSA, makeTuneControlGrid, makeTuneControlIrace, makeTuneControlMBO, makeTuneControlRandom, makeTuneWrapper, tuneParams, tuneThreshold

Examples

Run this code
# NOT RUN {
task = makeClassifTask(data = iris, target = "Species")
lrn = makeLearner("classif.rpart")
# stupid mini grid
ps = makeParamSet(
  makeDiscreteParam("cp", values = c(0.05, 0.1)),
  makeDiscreteParam("minsplit", values = c(10, 20))
)
ctrl = makeTuneControlGrid()
inner = makeResampleDesc("Holdout")
outer = makeResampleDesc("CV", iters = 2)
lrn = makeTuneWrapper(lrn, resampling = inner, par.set = ps, control = ctrl)
# nested resampling for evaluation
# we also extract tuned hyper pars in each iteration and by that the resampling indices
r = resample(lrn, task, outer, extract = getTuneResult)
# get tuning indices
getResamplingIndices(r, inner = TRUE)
# }

Run the code above in your browser using DataLab