1
votes

Is there a simple way to recover cross-validation predictions from the model built using lgb.cv from lightGBM?

I am doing a grid search combined with cross validation. Ultimately I would like to obtain the predictions for each of the defined hold-out folds so I can also stack a few models.

1

1 Answers

1
votes

the only way i have found is to continue to train (lgb.train) the same model (booster) to do this you must use init_model='model.txt'. Then save the models best iteration like this bst.save_model('model.txt', num_iteration=bst.best_iteration). Note this is python api, sorry. I have asked the same question but for the python api