powered by
Random folds for use in a cross validation are generated. There is the option for stratified splitting as well.
makefolds(ina, nfolds = 10, stratified = TRUE, seed = NULL)
A variable indicating the groupings.
The number of folds to produce.
A boolean variable specifying whether stratified random (TRUE) or simple random (FALSE) sampling is to be used when producing the folds.
You can specify your own seed number here or leave it NULL.
A list with nfolds elements where each elements is a fold containing the indices of the data.
I was inspired by the command in the package TunePareto in order to do the stratified version.
rda.tune
# NOT RUN { a <- makefolds(iris[, 5], nfolds = 5, stratified = TRUE) table(iris[a[[1]], 5]) ## 10 values from each group # }
Run the code above in your browser using DataLab