Skip to content

Instantly share code, notes, and snippets.

@tobigithub
tobigithub / nbaParallel.R
Created November 2, 2015 00:51
Wrapper for caret package to train multiple models in one call
#' Basketball: A function to run a lot of different models
#'
#' This function allows you to run a lot of different models from the caret package
#' @param method The methods to use i.e c("glm", "rf")
#' @param formula The formula to use
#' @param data The data frame to use. Can leave blank if supplying independent training and testing
#' @param regression Logical TRUE if type of model is "regression"
#' @param metric Metic to use. For example, "RMSE" if regression and "Accuracy" if classification
#' @param Train Do you want to supply a training set bypassing the partitioning
#' @param Test If you bypassed partition need to also supply testing set