scikit-learn/scikit-learn — pull request #1751 by tjanez (2013-03-07 11:43:56+00:00)
Title:  FIX KFold should return the same result when indices=True and when indices=False.

Here is an example of the problem:
```python
import numpy as np
from sklearn.cross_validation import KFold

kf_mask = KFold(10, 5, indices=False, shuffle=True, random_state=1)
kf_ind = KFold(10, 5, indices=True, shuffle=True, random_state=1)
for (train_mask, test_mask), (train_ind, test_ind) in zip(kf_mask, kf_ind):
print np.where(train_mask == True)[0]
print train_ind
print np.where(test_mask == True)[0]
print test_ind
```

The output is:
```python
[0 1 3 4 5 6 7 8]
[2 9 4 0 3 1 7 8]
[2 9]
[6 5]
[0 1 2 3 5 7 8 9]
[2 9 6 4 3 7 8 5]
[4 6]
[0 1]
[1 2 4 5 6 7 8 9]
[9 6 0 3 1 7 8 5]
[0 3]
[2 4]
[0 2 3 4 5 6 8 9]
[2 6 4 0 3 1 8 5]
[1 7]
[9 7]
[0 1 2 3 4 6 7 9]
[2 9 6 4 0 1 7 5]
[5 8]
[3 8]
```

The output with the fix applied is the following:
```python
[0 1 3 4 5 6 7 8]
[0 1 3 4 5 6 7 8]
[2 9]
[2 9]
[0 1 2 3 5 7 8 9]
[0 1 2 3 5 7 8 9]
[4 6]
[4 6]
[1 2 4 5 6 7 8 9]
[1 2 4 5 6 7 8 9]
[0 3]
[0 3]
[0 2 3 4 5 6 8 9]
[0 2 3 4 5 6 8 9]
[1 7]
[1 7]
[0 1 2 3 4 6 7 9]
[0 1 2 3 4 6 7 9]
[5 8]
[5 8]

```