When trying to run the R H2OEnsemble example, I get an error from the following command:
'fit <- h2o.ensemble(x = x, y = y, data = data, family = family,
+ learner = learner, metalearner = metalearner,
+ cvControl = list(V=4))'
The error is:
ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://127.0.0.1:54321/99/Rapids)
java.lang.IllegalArgumentException
[1] "water.rapids.ASTNumList.exec(ASTNumList.java:130)"
[2] "water.rapids.ASTAppend.apply(ASTAssign.java:226)"
[3] "water.rapids.ASTAppend.apply(ASTAssign.java:220)"
[4] "water.rapids.ASTExec.exec(ASTExec.java:46)"
[5] "water.rapids.ASTTmpAssign.apply(ASTAssign.java:255)"
[6] "water.rapids.ASTTmpAssign.apply(ASTAssign.java:248)"
[7] "water.rapids.ASTExec.exec(ASTExec.java:46)"
[8] "water.rapids.Session.exec(Session.java:56)"
[9] "water.rapids.Exec.exec(Exec.java:63)"
[10] "water.api.RapidsHandler.exec(RapidsHandler.java:23)"
[11] "sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)"
[12] "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[13] "java.lang.reflect.Method.invoke(Method.java:498)"
[14] "water.api.Handler.handle(Handler.java:64)"
[15] "water.api.RequestServer.handle(RequestServer.java:644)"
[16] "water.api.RequestServer.serve(RequestServer.java:585)"
[17] "water.JettyHTTPD$H2oDefaultServlet.doGeneric(JettyHTTPD.java:617)"
[18] "water.JettyHTTPD$H2oDefaultServlet.doPost(JettyHTTPD.java:565)"
[19] "javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"
[20] "javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"
[21] "org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
Number list not allowed here
In addition: Warning message:
In if (is.na(value)) value <- NA_integer_ else if (!is.numeric(value) && :
the condition has length > 1 and only the first element will be used
It seems the error is being generated by ASTNumList.java. I noticed that some commands in the R example have been updated, e.g. losing the localH2O in data <- as.h2o(localH2O, train). I'm wondering if the h2o.ensemble function has the correct arguments?
Any help would be greatly appreciated.
Thanks,
Gavin.
H2O version: 3.6.0.8; H2OEnsemble version: 0.0.3.
The example is from the help file:
library(h2oEnsemble)
library(SuperLearner) # For metalearner such as "SL.glm"
library(cvAUC) # Used to calculate test set AUC (requires version >=1.0.1 of cvAUC)
localH2O <- h2o.init(ip = "localhost", port = 54321, startH2O = TRUE, nthreads = -1)
# Import a sample binary outcome train/test set into R
train <- read.table("http://www.stat.berkeley.edu/~ledell/data/higgs_5k.csv", sep=",")
test <- read.table("http://www.stat.berkeley.edu/~ledell/data/higgs_test_5k.csv", sep=",")
# Convert R data.frames into H2O parsed data objects
data <- as.h2o(localH2O, train)
newdata <- as.h2o(localH2O, test)
y <- "V1"
x <- setdiff(names(data), y)
family <- "binomial"
# Create a custom base learner library & specify the metalearner
h2o.randomForest.1 <- function(..., ntrees = 1000, nbins = 100, seed = 1) h2o.randomForest.wrapper(..., ntrees = ntrees, nbins = nbins, seed = seed)
h2o.deeplearning.1 <- function(..., hidden = c(500,500), activation = "Rectifier", seed = 1) h2o.deeplearning.wrapper(..., hidden = hidden, activation = activation, seed = seed)
h2o.deeplearning.2 <- function(..., hidden = c(200,200,200), activation = "Tanh", seed = 1) h2o.deeplearning.wrapper(..., hidden = hidden, activation = activation, seed = seed)
learner <- c("h2o.randomForest.1", "h2o.deeplearning.1", "h2o.deeplearning.2")
metalearner <- c("SL.glm")
# Train the ensemble using 4-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, data = data, family = family,
learner = learner, metalearner = metalearner,
cvControl = list(V=4))
Gavin.
Sorry, as previously mentioned, I've replaced the data upload to H2O with the following lines:
data <- as.h2o(train)
newdata <- as.h2o(test)
library(devtools) install_github("h2oai/h2o-3/h2o-r/ensemble/h2oEnsemble-package")
Gavin.