Parameter "stratify" from method "train_test_split" (scikit Learn)
<p>I am trying to use <code>train_test_split</code> from package scikit Learn, but I am having trouble with parameter <code>stratify</code>. Hereafter is the code:</p>
<pre class="lang-py prettyprint-override"><code>from sklearn import cross_validation, datasets 

X = iris.data[:,:2]
y = iris.target

cross_validation.train_test_split(X,y,stratify=y)
</code></pre>
<p>However, I keep getting the following problem:</p>
<pre><code>raise TypeError(&quot;Invalid parameters passed: %s&quot; % str(options))
TypeError: Invalid parameters passed: {'stratify': array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])}
</code></pre>
<p>Does someone have an idea what is going on? Below is the function documentation.</p>
<blockquote>
<p>[...]</p>
<p><strong>stratify</strong> : array-like or None (default is None)</p>
<p>If not None, data is split in a stratified fashion, using this as the labels array.</p>
<p><em>New in version 0.17: stratify</em> splitting</p>
<p>[...]</p>
</blockquote>