Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
KFoldIterator - Splits wrongly, last fold is usually to small or even zero #5974
Expected behavior: KFoldIterator should split the dataset into k folds as evenly as possible.
Observed behavior: The last batch is often very small, in the range of 0..(k-1), which could explain the high variance of results in issue #5343
In the case that n is divisible by k and k-1 at the same time, this even creates an empty fold which will cause Exceptions later on.
Thanks to @RajaniVM for noticing the problem!
Thanks for the issue (and @RajaniVM for flagging) - easy to confirm with size 99, 10 splits: