How do I generate random folds for cross-validation in scikit-learn?
Imagine we have 20 samples of one class, and 80 of the other, and we need to generate N train and test sets, each train set of the size 30, under the constraint that in each training set, the we have 50% of class one and 50% of class 2.
I found this discussion (https://github.com/scikit-learn/scikit-learn/issues/1362) but I don't understand how to get folds. Ideally I think I need such a function:
cfolds = np.cross_validation.imaginaryfunction(
[list(itertools.repeat(1,20)), list(itertools.repeat(2,80))],
n_iter=100, test_size=0.70)
What am I missing?