Closed krz closed 8 years ago
Here is an example:
library(caretEnsemble) library('mlbench') data(Sonar) my_control <- trainControl( method='boot', number=25, savePredictions=TRUE, classProbs=TRUE, index=createResample(Sonar$Class, 25) ) model_list <- caretList( Class~., data=Sonar, trControl=my_control, methodList=c('glm', 'rpart') ) greedy_ensemble <- caretEnsemble(model_list)
fails to predict on one observation:
ens_preds <- predict(greedy_ensemble, newdata=Sonar[1,]) Error in `colnames<-`(`*tmp*`, value = c("glm", "rpart")) : attempt to set 'colnames' on an object with less than two dimensions
this works:
ens_preds <- predict(greedy_ensemble, newdata=rbind(Sonar[1,],Sonar[1,]))[1]
Should have been solved by #173, please double check.
Here is an example:
fails to predict on one observation:
this works: