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.

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

Examples

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)
#> [[1]] #> [[1]]$train.inds #> [[1]]$train.inds[[1]] #> [1] 22 59 30 64 67 4 37 61 69 31 63 73 43 36 7 54 15 3 19 60 49 38 34 52 53 #> [26] 62 27 29 14 68 44 40 72 51 2 20 65 9 12 56 5 74 47 71 35 66 46 33 8 23 #> #> #> [[1]]$test.inds #> [[1]]$test.inds[[1]] #> [1] 25 18 50 48 42 1 17 6 11 58 39 55 41 10 57 13 70 21 45 32 28 24 26 16 75 #> #> #> #> [[2]] #> [[2]]$train.inds #> [[2]]$train.inds[[1]] #> [1] 22 59 30 64 67 4 37 61 69 31 63 73 43 36 7 54 15 3 19 60 49 38 34 52 53 #> [26] 62 27 29 14 68 44 40 72 51 2 20 65 9 12 56 5 74 47 71 35 66 46 33 8 23 #> #> #> [[2]]$test.inds #> [[2]]$test.inds[[1]] #> [1] 25 18 50 48 42 1 17 6 11 58 39 55 41 10 57 13 70 21 45 32 28 24 26 16 75 #> #> #>