こんにちは、データ分析のためにパッケージ h2o ensemble の使用を開始しました (ここでは、https ://github.com/h2oai/h2o-3/tree/master/h2o-r/ensemble を使用し、デモ コードを試しました。
コードは以前はうまく機能していました:
## ## setting up h2o
library(h2oEnsemble)
nodes <- 2 ## number of processes
localH2O <- h2o.init(nthreads=nodes)
## ## simulated data set
dat <- matrix(rnorm(6e3), ncol=3, dimnames=list(NULL, c("W", "X", "Y")))
dat <- as.data.frame(dat)
Z <- as.factor(rbinom(nrow(dat), size=1, prob=plogis(.2+.1*dat$W-.2*dat$X)))
dat <- cbind(dat, Z=Z)
## W,X,Y: Input
## Z: output
dat.app <- dat[1:1e3, ]
dat.val <- dat[1e3+(1:1e3), ]
## ## h2o procedure
dat.h2o.app <- as.h2o(localH2O, dat.app) ## learning
dat.h2o.val <- as.h2o(localH2O, dat.val) ## validation
library.h2o <- c("h2o.deeplearning.Tanh",
"h2o.randomForest.1000x100")
h2o.randomForest.1000x100 <- function(...,ntrees=1000,nbins=100) {
h2oEnsemble::h2o.randomForest.wrapper(..., ntrees=ntrees, nbins=nbins,seed=1)
}
h2o.deeplearning.Tanh <- function(...,hidden=c(200, 200,200),activation="Tanh" ) {
h2oEnsemble::h2o.deeplearning.wrapper(..., hidden=hidden, activation=activation,seed=1)
}
h2o.model <- h2o.ensemble(y="Z", x=c("W", "X", "Y"),
training_frame=dat.h2o.app,
family="binomial",
learner=library.h2o,
cvControl=list(V=10, shuffle=TRUE),
metalearner="h2o.glm.wrapper") # getting the 400 bad request
h2o.pred.val <- predict(h2o.model, newdat=dat.h2o.val)$pred
table((h2o.pred.val>0.5)+0, dat.val$Z)
そして、突然400の悪いリクエストがスローされます(RTMP_5はすでに存在します)
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> ## ## setting up h2o
> library(h2oEnsemble)
> nodes <- 2 ## number of processes
> localH2O <- h2o.init(nthreads=nodes)
Successfully connected to http://127.0.0.1:54321/
R is connected to the H2O cluster:
H2O cluster uptime: 9 days 19 hours
H2O cluster version: 3.6.0.8
H2O cluster name: H2O_started_from_R_root_afl027
H2O cluster total nodes: 1
H2O cluster total memory: 6.98 GB
H2O cluster total cores: 6
H2O cluster allowed cores: 2
H2O cluster healthy: TRUE
>
> ## ## simulated data set
> dat <- matrix(rnorm(6e3), ncol=3, dimnames=list(NULL, c("W", "X", "Y")))
> dat <- as.data.frame(dat)
> Z <- as.factor(rbinom(nrow(dat), size=1, prob=plogis(.2+.1*dat$W-.2*dat$X)))
> dat <- cbind(dat, Z=Z)
> ## W,X,Y: input
> ## Z: output
> dat.app <- dat[1:1e3, ]
> dat.val <- dat[1e3+(1:1e3), ]
>
> ## ## h2o procedure
> dat.h2o.app <- as.h2o(dat.app) ## apprentissage
|
| | 0%
|
|======================================================================| 100%
> dat.h2o.val <- as.h2o(dat.val) ## validation
|
| | 0%
|
|======================================================================| 100%
>
> library.h2o <- c("h2o.deeplearning.Tanh",
+ "h2o.randomForest.1000x100")
>
> h2o.model <- h2o.ensemble(y="Z", x=c("W", "X", "Y"),
+ training_frame=dat.h2o.app,
+ family="binomial",
+ learner=library.h2o,
+ cvControl=list(V=10, shuffle=TRUE),
+ metalearner="h2o.glm.wrapper")
ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://127.0.0.1:54321/99/Rapids)
java.lang.IllegalArgumentException
[1] "water.rapids.ASTTmpAssign.apply(ASTAssign.java:254)"
[2] "water.rapids.ASTTmpAssign.apply(ASTAssign.java:248)"
[3] "water.rapids.ASTExec.exec(ASTExec.java:46)"
[4] "water.rapids.Session.exec(Session.java:56)"
[5] "water.rapids.Exec.exec(Exec.java:63)"
[6] "water.api.RapidsHandler.exec(RapidsHandler.java:23)"
[7] "sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)"
[8] "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[9] "java.lang.reflect.Method.invoke(Method.java:622)"
[10] "water.api.Handler.handle(Handler.java:64)"
[11] "water.api.RequestServer.handle(RequestServer.java:644)"
[12] "water.api.RequestServer.serve(RequestServer.java:585)"
[13] "water.JettyHTTPD$H2oDefaultServlet.doGeneric(JettyHTTPD.java:617)"
[14] "water.JettyHTTPD$H2oDefaultServlet.doPost(JettyHTTPD.java:565)"
[15] "javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"
[16] "javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"
[17] "org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
Temp ID RTMP_5 already exists
Calls : h2o.ensemble ... .eval.driver -> .h2o.__remoteSend -> .h2o.doSafeREST
Execution halted
私はちょっと迷っていて、今はうまくいかない理由がわかりません。トレーニングセットは適切な形式である必要があります。誰かがこの問題に遭遇しましたか?もしそうなら、どうやってこのエラーを乗り越えましたか?