# How to Ensemble LGBM and XGBoost Machine Learning Models?

I want to Ensemble my predictions for the StratifiedKFold of LGBM and XGBoost into another LGBM Model. I had written the following code which works when the data set has an ID_COL, but in this data set I don't have any ID_COL. It is simply based on the index. How can I ensemble the model in such case?

The Train and Test data are stored in train and test file respectively.

CODE

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


After this I pass train_new and test_new to a LGBM Model.

• you want two ensemble 2 gradient boosting with another gradietn boosting? So the ensembler only sees two columns with the predictions/ – Carlos Mougan Oct 7 '20 at 10:44
• There are many way to ensemble (voting, bagging, boosting)? Please be more specific. – Brian Spiering Mar 10 at 14:48