Created
November 25, 2015 04:31
-
-
Save wdkrnls/1373b1bc81156b29786d to your computer and use it in GitHub Desktop.
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
#' My function for doing cross validation (creating the splits before hand) | |
xvalidate <- function(f, formula, data, bin, ...) { | |
fold <- length(bin) | |
xs <- seq.int(1, fold) | |
lapply(xs, function(x) { | |
train <- data[unlist(bin[-x]),] | |
test <- data[bin[[x]],] | |
model <- f(formula, data = train, ...) | |
predict(model, newdata = test) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment