title: Creating train/test/val split with StratifiedKFold
body: <p>I'm trying to use <code>StratifiedKFold</code> to create train/test/val splits for use in a non-sklearn machine learning work flow. So, the DataFrame needs to be split and then stay that way.</p>
  
  <p>I'm trying to do it like the following, using <code>.values</code> because I'm passing pandas DataFrames:</p>
  
  <pre><code>skf = StratifiedKFold(n_splits=3, shuffle=False)
  skf.get_n_splits(X, y)
  
  for train_index, test_index, valid_index in skf.split(X.values, y.values):
      print("TRAIN:", train_index, "TEST:", test_index,  "VALID:", valid_index)
      X_train, X_test, X_valid = X.values[train_index], X.values[test_index], X.values[valid_index]
      y_train, y_test, y_valid = y.values[train_index], y.values[test_index], y.values[valid_index]
  </code></pre>
  
  <p>This fails with: </p>
  
  <pre class="lang-none prettyprint-override"><code>ValueError: not enough values to unpack (expected 3, got 2).
  </code></pre>
  
  <p>I read through all of the <code>sklearn</code> docs and ran the example code, but did not gain a better understanding of how to use stratified k fold splits outside of a <code>sklearn</code> cross-validation scenario. </p>
  
  <p>EDIT:</p>
  
  <p>I also tried like this:</p>
  
  <pre><code># Create train/test split
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, stratify=y)
  
  # Create validation split from train split
  X_train, X_valid, y_train, y_valid = train_test_split(X_train, y_train, test_size=0.05)
  </code></pre>
  
  <p>Which seems to work, although I imagine I'm messing with the stratification by doing so.</p>