While trying to run the example on H2OEnsemble found on http://learn.h2o.ai/content/tutorials/ensembles-stacking/index.html from within Rstudio, I encounter the following error:
Error in value[3L] : argument "training_frame" must be a valid H2O H2OFrame or id
after defining the ensemble
fit <- h2o.ensemble(x = x, y = y, training_frame = train, family = family, learner = learner, metalearner = metalearner, cvControl = list(V = 5, shuffle = TRUE))
I installed the latest version of both h2o
and h2oEnsemble
but the issue remains. I have read here `h2o.cbind` accepts only of H2OFrame objects - R that the naming convention in h2o
changed over time, but I assume by installing the latest version of both this should not be any longer the issue.
Any suggestions?
library(readr) library(h2oEnsemble) # Requires version >=0.0.4 of h2oEnsemble library(cvAUC) # Used to calculate test set AUC (requires version >=1.0.1 of cvAUC) localH2O <- h2o.init(nthreads = -1) # Start an H2O cluster with nthreads = num cores on your machine # Import a sample binary outcome train/test set into R train <- h2o.importFile("http://www.stat.berkeley.edu/~ledell/data/higgs_10k.csv") test <- h2o.importFile("http://www.stat.berkeley.edu/~ledell/data/higgs_test_5k.csv") y <- "C1" x <- setdiff(names(train), y) family <- "binomial" #For binary classification, response should be a factor train[,y] <- as.factor(train[,y]) test[,y] <- as.factor(test[,y]) # Specify the base learner library & the metalearner learner <- c("h2o.glm.wrapper", "h2o.randomForest.wrapper", "h2o.gbm.wrapper", "h2o.deeplearning.wrapper") metalearner <- "h2o.deeplearning.wrapper" # Train the ensemble using 5-fold CV to generate level-one data # More CV folds will take longer to train, but should increase performance fit <- h2o.ensemble(x = x, y = y, training_frame = train, family = family, learner = learner, metalearner = metalearner, cvControl = list(V = 5, shuffle = TRUE))