cv_kfold | R Documentation |
Generates folds for the classic k-fold cross validation where k mutually exclusive folds are generated and the training phase is done using k − 1 folds and the testing with the remaining one, which ensures all individuals are part of the testing once.
cv_kfold(records_number, k = 5)
records_number |
( |
k |
( |
A list
with k
elements where each element is a named list
with the
elements training
wich includes the indices of those records to be part of
the training set and testing
wich includes the indices of those records to
be part of the testing set. Training and testing sets of each fold are
exhaustive and mutually exclusive.
## Not run:
# Generates 5 folds of 2 elements (10 / 5) in testing set
folds <- cv_kfold(10, 5)
# Indices of training set in fold 1
folds[[1]]$training
# Indices of testing set in fold 1
folds[[1]]$testing
folds[[2]]$training
folds[[2]]$testing
folds <- cv_kfold(100, 30)
# List with indices of training and testing of fold 1
folds[[1]]
# List with indices of training and testing of fold 2
folds[[2]]
folds[[3]]
# ...
folds[[30]]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.