Description Usage Arguments Value Examples
This is a simple way to use k-fold cross validation.
1 | partition_fold(kfold, n, has.validation = FALSE)
|
kfold |
A |
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: |
A list contained train and test mldr dataset:
train
The mldr dataset with train examples, that includes all
examples except those that are in test and validation samples
test
The mldr dataset with test examples, defined by the
number of the fold
validation
Optionally, only if has.validation = TRUE
.
The mldr dataset with validation examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.