[英]Caret train method complains Something is wrong; all the RMSE metric values are missing
[英]Caret train method complains when trying to use H2o package: “Something is wrong; all the Accuracy metric values are missing”
當我想在此示例中使用插入符號中的 H2o 方法時,我收到一條錯誤消息:
library(caret)
library(h2o)
data(HELPrct)
ds = HELPrct
fitControl= trainControl(method="repeatedcv", number = 5)
ds$sub = as.factor(ds$substance)
h2oFit1 <- train(homeless ~ female + i1 + sub + sexrisk + mcs + pcs,
trControl=fitControl,
method = "gbm_h2o",
data=ds[complete.cases(ds),])
然后 R 告訴我:
Something is wrong; all the Accuracy metric values are missing:
Accuracy Kappa
Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA
Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA
NA's :9 NA's :9
Error: Stopping
In addition: Warning message:
In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, :
There were missing values in resampled performance measures.
有誰知道我如何使插入符號與 h2o 一起工作? 其他方法沒有任何問題。
如果我運行您的代碼並檢查警告:
warnings()
Warning messages:
1: model fit failed for Fold1.Rep1: max_depth=1, ntrees= 50, learn_rate=0.1, min_rows=10, col_sample_rate=1 Error in h2o.getConnection() :
No active connection to an H2O cluster. Did you run `h2o.init()` ?
所以你需要做h2o.init()
(查看網頁了解更多詳情):
library(caret)
library(h2o)
h2o.init()
ds = mosaicData::HELPrct
fitControl= trainControl(method="repeatedcv", number = 5)
ds$sub = as.factor(ds$substance)
h2oFit1 <- train(homeless ~ female + i1 + sub + sexrisk + mcs + pcs,
trControl=fitControl,
method = "gbm_h2o",
data=ds[complete.cases(ds),])
h2oFit1
Gradient Boosting Machines
117 samples
6 predictor
2 classes: 'homeless', 'housed'
No pre-processing
Resampling: Cross-Validated (5 fold, repeated 1 times)
Summary of sample sizes: 93, 94, 93, 94, 94
Resampling results across tuning parameters:
max_depth ntrees Accuracy Kappa
1 50 0.5826087 0.0669072
1 100 0.6253623 0.1895957
1 150 0.6420290 0.2188447
2 50 0.6159420 0.1708235
2 100 0.6072464 0.1513658
2 150 0.6329710 0.2035319
3 50 0.6253623 0.1878658
3 100 0.6159420 0.1701928
3 150 0.6420290 0.1761487
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.