Skip to contents

An S3 generic method to retrieve the training sample indices for a specific fold from a cross-validation specification object.

Usage

train_indices(obj, fold_num, ...)

Arguments

obj

A cross-validation specification object (e.g., inheriting from `cross_validation`).

fold_num

An integer specifying the fold number for which to retrieve training indices.

...

Additional arguments passed to methods.

Value

An integer vector of training indices.

Examples

cval <- kfold_cross_validation(len = 20, nfolds = 4)
train_indices(cval, 1)
#>  [1]  1  2  4  5  6  7  9 10 11 12 13 14 15 18 19