简体   繁体   English

我的H2O群集版本是否与h2oEnsemble 1.9不兼容,或者在不使用贝叶斯函数的情况下导致此“朴素贝叶斯”错误的原因?

[英]Is my H2O cluster version incompatible with h2oEnsemble 1.9, or what causes this “Naive Bayes” error when no Bayesian function is being used?

The h2oEnsemble library's author, Dr. LeDell, suggested checking out v1.9 from the h2o-3 GitHub repo to work around a problem I and others encountered, which is described in this thread. h2oEnsemble库的作者LeDell博士建议从h2o-3 GitHub h2oEnsemble库中检出v1.9,以解决我和其他人遇到的问题, 线程对此进行了描述。

This led to a different error in my case, where only the unmodified wrappers can be used with h2oEnsemble::h2o.ensemble() . 在我的情况下,这导致了另一个错误,其中只有未经修改的包装器才能与h2oEnsemble::h2o.ensemble()

For instance, learners like this will work: 例如,像这样的学习者将可以工作:

learner <- c("h2o.deeplearning.wrapper", "h2o.randomForest.wrapper", "h2o.glm.wrapper") 

But anything custom like this: 但是像这样的任何自定义:

h2o.glm.2 <- function(..., alpha = 0.5) h2o.glm.wrapper(..., alpha = alpha)
learner <- c("h2o.glm.2") 

ens2 <- h2o.ensemble(x             = setdiff(colnames(train), "y"),
                    y              = "y",
                    training_frame = trainHex,
                    metalearner    = "h2o.deeplearning.wrapper",
                    learner        = learner)

throws this error: 抛出此错误:

 Error in h2o.ensemble(x = setdiff(colnames(train), "y"), y = "y", training_frame = trainHex, : The Naive Bayes function does not support regression, please remove this function from your set of base learners 

Dr. LeDell suggested to confirm compatibility through her compatibility table on GitHub and to move further questions to StackOverflow (because they are shutting down their forum). LeDell博士建议通过其在GitHub上的兼容性表来确认兼容性,并将其他问题移至StackOverflow(因为他们正在关闭论坛)。

It seems that v1.9 is not on that table though and my H2O cluster version is also newer than what was listed there. 似乎v1.9不在该表上,而且我的H2O群集版本也比那里列出的版本新。 Does anyone have anecdotal knowledge of which H2O clusters will work with v1.9 of the R package? 是否有人对R包的v1.9可以使用哪些H2O群集有一定的了解?

> h2o.getVersion()

"3.10.0.2" “3.10.0.2”

Update: I tried upgrading to 3.12 and 3.13, but encountered the same error with this. 更新:我尝试升级到3.12和3.13,但是与此同时遇到了相同的错误。 Though I did notice that h2o::h2o.stackedEnsemble() works in 3.13. 虽然我确实注意到h2o::h2o.stackedEnsemble()在3.13中有效。

Update: 更新:

The package author suggested version 3.10.5.2 in the comments/updated question. 软件包作者在注释/更新的问题中建议了3.10.5.2版。 I tried updating to that, but sadly the problem still occurred. 我尝试进行更新,但可悲的是问题仍然存在。 Here's my cluster info after the update: 这是更新后的集群信息:

> h2o.init(nthreads = -1) 
  Connection successful! R is connected to the H2O cluster: H2O cluster uptime: 2 minutes 28 seconds H2O cluster version: 3.10.5.2 H2O cluster version age: 15 days H2O cluster name: hackr H2O cluster total nodes: 1 H2O cluster total memory: 16.98 GB H2O cluster total cores: 24 H2O cluster allowed cores: 24 H2O cluster healthy: TRUE H2O Connection ip: localhost H2O Connection port: 54321 H2O Connection proxy: NA H2O Internal Security: FALSE R Version: R version 3.4.0 Patched (2017-05-19 r72713) 

Doesn't work with custom learner: 不适用于自定义学习器:

h2o.glm.2 <- function(..., alpha = 0.5) h2o.glm.wrapper(..., alpha = alpha)
learner <- c("h2o.glm.2", "h2o.deeplearning.wrapper", "h2o.randomForest.wrapper", "h2o.glm.wrapper")

ens <- h2o.ensemble(x              = setdiff(colnames(train), "y"),
                    y              = "y",
                    training_frame = trainHex,
                    metalearner    ="h2o.randomForest.wrapper",
                    learner        = learner)
summary(ens)

Error in h2o.ensemble(x = setdiff(colnames(train), "y"), y = "y", training_frame = trainHex, : The Naive Bayes function does not support regression, please remove this function from your set of base learners. h2o.ensemble(x = setdiff(colnames(train),“ y”),y =“ y”,training_frame = trainHex,中的错误:Naive Bayes函数不支持回归,请从基础学习者集中删除此函数。

but works with only default wrapper learners: 但仅适用于默认包装学习器:

learner <- c("h2o.deeplearning.wrapper", "h2o.randomForest.wrapper", "h2o.glm.wrapper")

ens <- h2o.ensemble(x              = setdiff(colnames(train), "y"),
                    y              = "y",
                    training_frame = trainHex,
                    metalearner    ="h2o.randomForest.wrapper",
                    learner        = learner)
summary(ens)

R package version is h2o_3.10.5.2 . R软件包版本为h2o_3.10.5.2

h2oEnsemble v0.1.9 package has not been officially released yet, but it's on the "h2oEnsemble_v0.1.9" branch here . h2oEnsemble v0.1.9软件包尚未正式发布,但位于此处的“ h2oEnsemble_v0.1.9”分支中。 On the README for that branch, the updated table shows that it will be compatible with H2O >=3.10.1.*. 在该分支的自述文件上,更新后的表显示它与H2O> = 3.10.1。*兼容。

It looks like you are doing a regression problem and attempting to use the h2o.naiveBayes.wrapper() function? 看来您在做回归问题并尝试使用h2o.naiveBayes.wrapper()函数? The error message tells you that can't use Naive Bayes on a regression problem (Naive Bayes is a classification algorithm and does not support regression). 该错误消息告诉您不能在回归问题上使用朴素贝叶斯(朴素贝叶斯是一种分类算法,不支持回归)。

Using the "h2oEnsemble_v0.1.9" branch version of h2oEnsemble and the latest stable release of H2O, 3.10.5.2, I can replicate your error using the code below, but all you need to do to fix it is remove the Naive Bayes model from your base learners: 使用h2oEnsemble的“h2oEnsemble_v0.1.9”分支版本和H2O,3.10.5.2的最新的稳定版本,我可以使用下面的代码复制你的错误,但所有你需要做修复它是从去除朴素贝叶斯模型的基础学习者:

library(h2oEnsemble)  # Install from h2oEnsemble_v0.1.9 branch
h2o.init()

# Import a sample binary outcome train/test set into R
train <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_train_5k.csv")
test <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_test_5k.csv")
y <- "response"
x <- setdiff(names(train), y)
family <- "gaussian"


# Specify the base learner library & the metalearner
learner <- c("h2o.glm.wrapper", "h2o.randomForest.wrapper", 
             "h2o.gbm.wrapper", "h2o.naiveBayes.wrapper")
metalearner <- "h2o.glm.wrapper"

# Train the ensemble 
fit <- h2o.ensemble(x = x, y = y, 
                    training_frame = train, 
                    family = family, 
                    learner = learner, 
                    metalearner = metalearner)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM