Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 当试图使用H2o包时,插入符号训练方法会出现问题:“使用;有点不对劲;所有精度度量值均缺失“;_R_R Caret_H2o - Fatal编程技术网

R 当试图使用H2o包时,插入符号训练方法会出现问题:“使用;有点不对劲;所有精度度量值均缺失“;

R 当试图使用H2o包时,插入符号训练方法会出现问题:“使用;有点不对劲;所有精度度量值均缺失“;,r,r-caret,h2o,R,R Caret,H2o,在本例中,当我想在插入符号中使用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

在本例中,当我想在插入符号中使用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),])

有人知道我如何使插入符号与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()
(有关更多详细信息,请查看):

库(插入符号)
图书馆(h2o)
h2o.init()
ds=马赛克数据::HELPrct
fitControl=列车控制(方法=“repeatedcv”,编号=5)
ds$次级=作为系数(ds$物质)

h2oFit1如果我运行您的代码并检查警告:

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()
(有关更多详细信息,请查看):

库(插入符号)
图书馆(h2o)
h2o.init()
ds=马赛克数据::HELPrct
fitControl=列车控制(方法=“repeatedcv”,编号=5)
ds$次级=作为系数(ds$物质)
h2oFit1
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