我发现现在可以在h2o v3.22.1.1
中使用stopping_metric = custom
(在v3.10.0.9
中不可用),但是我没有找到如何在R中实现它的地方。
这是问题的玩具版本。
library(h2o)
h2o.init()
x <- data.frame(
x = rnorm(1000),
z = rnorm(1000),
y = factor(sample(0:1, 1000, replace = T))
)
train <- as.h2o(x)
h2o.gbm(x = c('x','z'), y = 'y', training_frame = train, stopping_metric = 'custom', stopping_rounds = 3)
我得到的错误如下:
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
ERROR MESSAGE:
Illegal argument(s) for GBM model: GBM_model_R_1548836369139_123. Details: ERRR on field: _stopping_metric: Custom metric function needs to be defined in order to use it for early stopping.
如何定义 GBM 的custom
stopping_metric
?
这目前无法从 R API 获得。如果这是您感兴趣的功能,我会在这里使用您的用例创建一个 JIRA。您可以使用 Darren 指出的另一个 SO 问题,以获取有关如何通过 Python API 使用此功能的信息。