我尝试使用h2o.grid()
h2o 包中的函数使用 R 进行一些调整,当我将参数设置为parallelism
大于 1 时,它总是显示警告
某些模型由于失败而未构建,有关更多详细信息,请运行 `summary(grid_object, show_stack_traces = TRUE)
并且最终网格对象中的model_ids包含很多以等结尾的模型_cv_1
,_cv_2
而且模型的数量不等于我max_models
的in search_criteria
list的设置,我认为它们只是cv
过程中的模型,而不是最终的模型。
当我设置parallelism
大于 1 时:
当我保留默认值或设置为 1 时,结果是正常的,所有模型都以等parallelism
结尾。_model_1
_model_2
当我保留“并行度”默认值或将其设置为 1 时:
这是我的代码:
# set the grid
rf_h2o_grid <- list(mtries = seq(3, ncol(train_h2o), 4),
max_depth = c(5, 10, 15, 20))
# set the search_criteria
sc <- list(strategy = "RandomDiscrete",
seed = 100,
max_models = 5
)
# random grid tuning
rf_h2o_grid_tune_random <- h2o.grid(
algorithm = "randomForest",
x = x,
y = y,
training_frame = train_h2o,
nfolds = 5, # use cv to validate the parameters
fold_assignment = "Stratified",
ntrees = 100,
seed = 100,
hyper_params = rf_h2o_grid,
search_criteria = sc
# parallelism = 6 # when I set it larger than 1, the result always includes some "cv_" models
)
那么如何parallelism
正确使用 inh2o.grid()
呢?感谢您的帮助!