caretEnsemble
caretEnsemble copied to clipboard
using custom caret model with caretEnsemble. How?
caretEnsemble seems to check for model name in caretList and it doesn't like model names that are not returned by caret. Here is a simple custom model that I'd like to use in caretList.
elm_fun <- getModelInfo("elm")[[1]]
elm_fun$prob <- function (modelFit, newdata, submodels = NULL) {
out <- exp(predict(modelFit, newdata))
t(apply(out, 1, function(x) x/sum(x)))
}
elmFit1 <- train(factor(train_sub$target) ~ .,
data = train_sub,
method = elm_fun,
trControl = fitControl,
metric="ROC",
verbose=T,
tuneGrid=expand.grid(nhid=seq(4000,5000,by=1000),
actfun=c('purelin')))
I haven't tried it yet but I'm assuming I can always add elmFit1 to the caretList but was wondering if there is way to do it all in caretList.
FR
Yeah, caretEnsemble doesn't like custom models at the moment. We're working on that
Was this ever resolved?
Yes, https://github.com/zachmayer/caretEnsemble/pull/198 should have resolved this