尝试在Rstudio中的http://learn.h2o.ai/content/tutorials/ensembles-stacking/index.html上找到H2OEnsemble上的示例时,遇到以下错误:
值[3L]出错: 参数“training_frame”必须是有效的H2O H2OFrame或id
定义整体后
fit <- h2o.ensemble(x = x, y = y,
training_frame = train,
family = family,
learner = learner,
metalearner = metalearner,
cvControl = list(V = 5, shuffle = TRUE))
我安装了h2o
和h2oEnsemble
的最新版本,但问题仍然存在。我在这里`h2o.cbind` accepts only of H2OFrame objects - R已经看到h2o
中的命名约定随着时间的推移而发生了变化,但我认为通过安装这两者的最新版本,这应该不再是问题。
有什么建议吗?
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))
答案 0 :(得分:3)
最近通过批量查找/替换对h2o R代码进行的类名更改来引入此错误。这个改变也无意中应用于整体代码文件夹(我们目前有手动代替自动测试 - 很快就会自动防止这种事情)。我修复了这个bug。
要修复,请从GitHub重新安装h2oEnsemble包:
library(devtools)
install_github("h2oai/h2o-3/h2o-r/ensemble/h2oEnsemble-package")
感谢您的举报!为了更快地回复,请在此处发布错误和问题:https://groups.google.com/forum/#!forum/h2ostream