title: sklearn Kfold acces single fold instead of for loop
body: <p>After using cross_validation.KFold(n, n_folds=folds) I would like to access the indexes for training and testing of single fold, instead of going through all the folds.</p>
  <p>So let's take the example code:</p>
  <pre><code>from sklearn import cross_validation
  X = np.array([[1, 2], [3, 4], [1, 2], [3, 4]])
  y = np.array([1, 2, 3, 4])
  kf = cross_validation.KFold(4, n_folds=2)
  
  &gt;&gt;&gt; print(kf)  
  sklearn.cross_validation.KFold(n=4, n_folds=2, shuffle=False,
                             random_state=None)
  &gt;&gt;&gt; for train_index, test_index in kf:
  </code></pre>
  <p>I would like to access the first fold in kf like this (instead of for loop):</p>
  <pre><code>train_index, test_index in kf[0]
  </code></pre>
  <p>This should return just the first fold, but instead I get the error: &quot;TypeError: 'KFold' object does not support indexing&quot;</p>
  <p>What I want as output:</p>
  <pre><code>&gt;&gt;&gt; train_index, test_index in kf[0]
  &gt;&gt;&gt; print(&quot;TRAIN:&quot;, train_index, &quot;TEST:&quot;, test_index)
  TRAIN: [2 3] TEST: [0 1]
  </code></pre>
  <p>Link: <a href="http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.KFold.html" rel="noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.KFold.html</a></p>
  <h2>Question</h2>
  <p>How do I retrieve the indexes for train and test for only a single fold, without going through the whole for loop?</p>