Created
April 15, 2015 12:02
-
-
Save AlexEngelhardt/73578fffad54b2398bcc to your computer and use it in GitHub Desktop.
Function to generate list of test set indices for cross validation
This file contains 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
cv.folds <- function(n, folds = 10) { split(sample(1:n), rep(1:folds, length = n)) } | |
## cv_indices <- cv.folds(length(testable_rows), K) # list of 10 indices of testable_rows | |
## cv_groups <- lapply(cv_indices, function(x) testable_rows[x]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment