R/TrainModels.R

Defines functions TrainModels

Documented in TrainModels

#' Train Model 
#' 
#' This function takes a test dataset and fits our CART Classification Tree model and Logistic Regression GLM model to the given set.
#' 
#' @param train The dataset you would like to train models on, if goal is prediction must use Split() ahead of time so model is naive to test observations.
#' 
#' @export


TrainModels <- function(train){
  out <- list()
  
  C5_model <- C50::C5.0(x = train[,c("ML","SP","SPTDR","MLTR","SPTR","PBR","MLTDR","H1A0")],
                        y = train$strWL,
                        control = C50::C5.0Control(minCases = 1))
  
  GLM_model <- glm(strWL~SP+SPTR*D0F1+H1A0+MLTR:D0F1+ML:SPTR+PBR,data = train,family=binomial)
  out[[1]] <- C5_model
  out[[2]] <- GLM_model
  return(out)
}
dennist2/MerlinV1 documentation built on Dec. 11, 2019, 8:41 p.m.