stratify_folds | R Documentation |
Returns a vector of fold IDs that preserves class proportions.
stratify_folds(y, nfolds = 10, seed = NULL)
y |
Numeric vector for the (binomial) response variable. |
nfolds |
Number of folds (default: 10). |
seed |
An integer that is used as argument by |
Numeric vector with the same length as y
.
y <- rbinom(100, 1, 0.3)
foldids <- stratify_folds(y, nfolds = 5)
table(y, foldids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.