我使用H2o库运行我的模型。我运行了5倍交叉验证。
model = H2OGradientBoostingEstimator(
balance_classes=True,
nfolds=5,
keep_cross_validation_fold_assignment=True,
seed=1234)
model.train(x=predictors,y=response,training_frame=data)
print('rmse: ',model.rmse(xval=True))
print('R2: ',model.r2(xval=True))
data_nfolds = model.cross_validation_fold_assignment()我有交叉验证折叠作业。我尝试用ntree或stopping_rounds等其他参数将它重用为新模型,但在文档中没有找到它。
发布于 2020-11-11 18:07:17
我找到了答案。
nfolds_index = h2o.import_file('myfile_index.csv')
nfolds_index.set_names(["fold_numbers"])
data = data.cbind(nfolds_index)
model2 = H2OGradientBoostingEstimator( seed=1234)
model2.train(x=predictors,y=response,training_frame=data, fold_column="fold_numbers")
print('rmse: ',model2.rmse(xval=True))
print('R2: ',model2.r2(xval=True))https://stackoverflow.com/questions/64790872
复制相似问题