R/caret.train.model.list.formula.R

#' Can take x and y values as the defaults.
#' @param formula
#' @param data
#' @param trControl passed directly to train {caret}; a list of values that define how this function acts. Default value if each item doesn't have its own trControl. See trainControl and http://topepo.github.io/caret/training.html#custom. (NOTE: If given, this argument must be named.)
#' @param training.list; a list describing a list of train {caret} values to run. Should be a list of objects generated by get.caret.model.spec. Each should contain exactly two values, to be passed to train {caret}: method and tuning. If tuning is an integer, it will be passed to tuneLength. If tuning is a data frame, it will be passed to tuneGrid. If it is null, train's default values for tuneLength will apply. Otherwise an error is generated.
#' @export
#' 
caret.train.model.list.formula <- function(formula,data,trControl,training.list,...){
  print("running as formula...")
  #we might have to do this differently in the future, but for now, there's no
  #difference in the handling, and the train method should disambiguate whether its own formula or default function is being called.
  
  #so one small thing is that neuralnet doesn't support "." in formulae.
  if ("." %in% as.character(formula) && any(sapply(training.list,function(x){x$method=="neuralnet"}))){
    stop("Unfortunately, when package mvpa was written, the package neuralnet did not support the '.' notation in formula; see http://stackoverflow.com/questions/17794575/error-in-terms-formulaformula-in-formula-and-no-data-argument. Contact the developer if this has changed; otherwise, you will need to convert the formula to some other format.")
  }
  return(caret.train.model.list.default(formula, data, trControl, training.list))
}
bjsmith/r-mvpa documentation built on May 30, 2019, 11:53 a.m.