partition_fold {utiml}R Documentation

Create the multi-label dataset from folds

Description

This is a simple way to use k-fold cross validation.

Usage

partition_fold(kfold, n, has.validation = FALSE)

Arguments

kfold

A kFoldPartition object obtained from use of the method create_kfold_partition.

n

The number of the fold to separated train and test subsets.

has.validation

Logical value that indicate if a validation dataset will be used. (Default: FALSE)

Value

A list contained train and test mldr dataset:

trainThe mldr dataset with train examples, that includes all examples except those that are in test and validation samples testThe mldr dataset with test examples, defined by the number of the fold validationOptionally, only if has.validation = TRUE. The mldr dataset with validation examples

Examples

folds <- create_kfold_partition(toyml, 10)

# Using the first partition
dataset <- partition_fold(folds, 1)
names(dataset)
## [1] "train" "test"

# All iterations
for (i in 1:10) {
   dataset <- partition_fold(folds, i)
   #dataset$train
   #dataset$test
}

# Using 3 folds validation
dataset <- partition_fold(folds, 3, TRUE)
# dataset$train, dataset$test, #dataset$validation

[Package utiml version 0.1.7 Index]