Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print.caretStack is hardcoded to say "ensemble of 2 base models" #251

Open
gmonaie opened this issue Dec 17, 2019 · 0 comments
Open

print.caretStack is hardcoded to say "ensemble of 2 base models" #251

gmonaie opened this issue Dec 17, 2019 · 0 comments

Comments

@gmonaie
Copy link

gmonaie commented Dec 17, 2019

Code:

> getS3method('print', 'caretStack')
function (x, ...) 
{
    n <- length(x$models)
    cat(paste("A", x$ens_model$method, "ensemble of 2 base models:", 
        paste(sapply(x$models, function(x) x$method), collapse = ", ")))
    cat("\n\nEnsemble results:\n")
    print(x$ens_model)
}
<bytecode: 0x7feea7772bc8>
<environment: namespace:caretEnsemble>

Minimal dataset:

set.seed(1)
dat <- caret::twoClassSim(100)
X <- dat[,1:5]
y <- dat[["Class"]]

Minimal, runnable code:

library(caretEnsemble)
models <- caretList(
  X, y, 
  methodList=c('glm', 'rpart', 'nnet'),
  trControl=trainControl(
    method="cv", 
    number=5,
    classProbs=TRUE, 
    savePredictions="final")
)
ens <- caretStack(models)
print(ens)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant