我发现从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工单,描述您的使用案例。您可以参考这个StackOverflow问题,了解如何通过Python API使用此功能。