X = range(0,10) target = np.array([0, 1] * 5) print target skf = model_selection.StratifiedKFold(n_splits = 2,shuffle = True) for train_indices, test_indices in skf.split(X, target): print train_indices, test_indices #[0 1 0 1 0 1 0 1 0 1] #[1 2 4 9] [0 3 5 6 7 8] #[0 3 5 6 7 8] [1 2 4 9