I wonder if there is a way to combine the prediction of two different models built on two different sets of input functions. For example, first by the functions 1:10, and then by 11:20, and in combination with the CaretEnssemble function of the caretStack function.
I'm trying to:
data("mtcars") head(mtcars) library(caret) library(caretEnsemble) library(glmnet) library(gbm) ma_control <- trainControl(method = "cv", number = 2, summaryFunction = RMSE, verboseIter = TRUE, savePredictions = TRUE) subset1 <- mtcars[,c(2:3,1)] subset2 <- mtcars[,c(4:5,1)] classification_formula1 <- as.formula(paste("mpg" ,"~", paste(names(subset1)[!names(subset1)=='mpg'],collapse="+"))) classification_formula2 <- as.formula(paste("mpg" ,"~", paste(names(subset2)[!names(subset2)=='mpg'],collapse="+"))) emf_tuneGrid_list <- NULL; emf_tuneGrid_list$glmnet1_tuneGrid <- expand.grid(alpha = 1.0 ,lambda = 1) emf_tuneGrid_list$gbm2_tuneGrid <- expand.grid(interaction.depth = 1, n.trees = 101 , shrinkage = 0.5 , n.minobsinnode = 5) emf_model_list <- caretList ( trControl=ma_control, metric = "RMSE", tuneList=list( glmnet1= caretModelSpec(method='glmnet', classification_formula = classification_formula1 , data = subset1 , tuneGrid=emf_tuneGrid_list$glmnet1_tuneGrid), gbm2 = caretModelSpec(method='gbm', classification_formula = classification_formula2, data = subset2 , tuneGrid=emf_tuneGrid_list$gbm2_tuneGrid , verbose = FALSE) ) )
But get an error in extractCaretTarget.default (...): the argument "y" is missing, with no default value
source share