k_fold | R Documentation |
k-fold partition of a dataset using a sampling method
k_fold(obj, data, k)
obj |
object |
data |
dataset |
k |
number of folds |
k folds
#using random sampling
sample <- sample_random()
# preparing dataset into four folds
folds <- k_fold(sample, iris, 4)
# distribution of folds
tbl <- NULL
for (f in folds) {
tbl <- rbind(tbl, table(f$Species))
}
head(tbl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.