我想将我对 LGBM 和 XGBoost 的 StratifiedKFold 的预测集成到另一个 LGBM 模型中。我编写了以下代码,该代码在数据集具有 ID_COL 时有效,但在此数据集中我没有任何 ID_COL。它只是基于索引。在这种情况下,我该如何组合模型?
train训练和测试数据分别存储在test文件中。
代码
train_new = train[[TARGET_COL]]
test_new = test[[ID_COL]] #ID_COL is not available in data.
train_new['lgb'] = lgb_oofs
test_new['lgb'] = lgb_preds
train_new['xgb'] = xgb_oofs
test_new['xgb'] = xgb_preds
在此之后,我通过train_new并test_new进入 LGBM 模型。