Stratified KFold CV for Regression


#1

Hi,

I want to create a Stratified KFold with a flag variable which values are 0 and 1. Then I want to use xgb.cv with this custom fold instance. If I create any KFold instance and use it as a fold in xgb.cv parameters it works without any problem but when I want to use Stratifed KFold I got IndexError: list index out of range error. When using KFold folds = KFold() is enough. For Stratified one need to define split argument with y. So I’m trying with folds = StratifiedKFold().split(X,y) and get index error. I can use lightgbm with that way without any problem. Is there any proper way to use it? Thanks in advance.