Learn R Programming

mldr.datasets (version 0.3.1)

random.kfolds: Partition an mldr object into k folds

Description

This method randomly partitions the given dataset into k folds, providing training and test partitions for each fold.

Usage

random.kfolds(mld, k = 5, seed = 10)

Arguments

mld
The mldr object to be partitioned
k
The number of folds to be generated. By default is 5
seed
The seed to initialize the random number generator. By default is 10. Change it if you want to obtain partitions containing different samples, for instance to use a 2x5 fcv strategy

Value

  • An mldr.folds object. This is a list containing k elements, one for each fold. Each element is made up of two mldr objects, called train and test

Examples

Run this code
library(mldr.datasets)
library(mldr)
folds.emotions <- random.kfolds(emotions)
summary(folds.emotions[[1]]$train)
summary(folds.emotions[[1]]$test)

Run the code above in your browser using DataLab