question: protected List < List < T > > splitData ( Iterable < T > data , int dataSize ) { List < List < T > > splits = new ArrayList < > ( ) ; int size = ( int ) Math . ceil ( ( double ) dataSize / numFolds ) ; int current = 0 ; List < T > l = new ArrayList < > ( ) ; int count = 0 ; for ( T item : data ) { l . add ( item ) ; count ++ ; if ( count > dataSize ) break ; } Collections . shuffle ( l , randomSeed ) ; for ( int i = 0 ; i < numFolds ; i ++ ) { int start = current ; int end = Math . min ( current + size , dataSize ) ; splits . add ( l . subList ( start , end ) ) ; current = end ; } return splits ; }
target:  Splits the data into numFolds parts. <p> Note: This splits the data into K folds uniformly. If the classes are not equally distributed, then this is wrong. Instead, override this to do a stratified split, so that the split proportions are maintained.