confused about random_state in decision tree of scikit learn
<p>Confused about <code>random_state</code> parameter, not sure why decision tree training needs some randomness. My thoughts</p>
<ol>
<li>is it related to random forest?</li>
<li>is it related to split training testing data set? If so, why not use training testing split method directly (<a href="http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.train_test_split.html" rel="nofollow noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.train_test_split.html</a>)?</li>
</ol>
<p><a href="http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html" rel="nofollow noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html</a></p>
<pre><code>from sklearn.datasets import load_iris
from sklearn.cross_validation import cross_val_score
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(random_state=0)
iris = load_iris()
cross_val_score(clf, iris.data, iris.target, cv=10)
...                             
...
array([ 1.     ,  0.93...,  0.86...,  0.93...,  0.93...,
        0.93...,  0.93...,  1.     ,  0.93...,  1.      ])
</code></pre>