Description Usage Arguments Value Examples
Create folds based on training data fed in.
1 2 3 4 5 6 |
data |
The training data set |
foldNumber |
the number of folds for cross-validation. Default is 5. |
stratifyOnVar |
Logical. Should the folds be stratified based on the response? If so, set TRUE. |
whatVarToStratifyOn |
Character. What is the name of the variable to stratify on? |
An rsample::vfold_cv() object.
1 2 3 4 5 6 7 8 9 10 | library(easytidymodels)
library(dplyr)
utils::data(penguins, package = "modeldata")
resp <- "sex"
split <- trainTestSplit(penguins, stratifyOnResponse = TRUE, responseVar = resp)
formula <- stats::as.formula(paste(resp, ".", sep="~"))
rec <- recipes::recipe(formula, data = split$train) %>% recipes::prep()
train_df <- recipes::bake(rec, split$train)
folds <- cvFolds(train_df)
folds
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.