Created
October 7, 2019 18:12
-
-
Save monogenea/26e3e558263b13be39a3e14019886076 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split train/test with rsample | |
set.seed(100) | |
initSplit <- initial_split(X, prop = .9, | |
strata = "Y") | |
trainSet <- training(initSplit) | |
testSet <- testing(initSplit) | |
# Create 5-fold cross-validation, convert to caret class | |
set.seed(100) | |
myFolds <- vfold_cv(trainSet, v = 5, repeats = 5, | |
strata = "Y") %>% | |
rsample2caret() | |
ctrl <- trainControl(method = "cv", | |
selectionFunction = "oneSE") | |
ctrl$index <- myFolds$index | |
ctrl$indexOut <- myFolds$indexOut |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment