cv_random | R Documentation |
Generates folds for cross validation where you specify the number of folds and the proportion of testing. In each fold a sample without replacement of the specified proportion of testing individuals is taken to be the testing set and all the remaining ones to be the training set.
cv_random(records_number, folds_number = 5, testing_proportion = 0.2)
records_number |
( |
folds_number |
( |
testing_proportion |
( |
A list
with folds_number
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 random data
folds <- cv_random(10, 5, 0.2)
# 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
# Generates 30 folds with 30 elements in testing set
folds <- cv_kfold(100, 30, 0.3)
# 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.