Solved by ptrblck in post #2 
              
              
                It seems that train_y is smaller in one iteration for some reason. 
Could you check the shape of X and y and make sure they contain the same number of samples? 

What’s your use case btw.?