在 H2O 堆叠模型中获取特定模型

Get specific model in H2O stacked model

所以我在 H2O 中使用 GridSearch 训练了几个 GBM 模型。

然后我像这样训练了一个集成模型:

from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator

#List of all models in the GridSearch
all_model_ids=grid_search_gbm.model_ids


ensemble = H2OStackedEnsembleEstimator(
    model_id = 'ensemble_gbm' ,
    base_models = all_model_ids
)

ensemble.train(
    x=training_columns, 
    y=response_column,
    training_frame=train,
)

我无法只从 "grid_search_gbm" 中提取特定模型并将其输入 "H2OStackedEnsembleEstimator()"。有提取方法吗?例如 'grid_search_gbm'?

中的 3 个最佳模型

你试过了吗

grid_search_gbm.model_ids[:3]

它应该为您提供与

相同的型号 ID
grid_search_gbm.sorted_metric_table()['model_ids'][:3]