>>> from sklearn.ensemble import RandomForestClassifier
>>> clf = RandomForestClassifier(n_estimators=10, random_state=1)
>>> Y=[0,1]
>>> X = [[3,2,1,0], [7,6,5,4]]
>>> clf = clf.fit(X, Y)
>>> print clf.feature_importances_
[ 0.2 0.1 0.1 0. ]
>>> X = [[0, 1, 2,3], [4,5,6,7]]
>>> clf = clf.fit(X, Y)
>>> print clf.feature_importances_
[ 0.2 0.1 0.1 0. ]
>>> X = [[3,2,1,0], [7,6,5,4]]
>>> clf = clf.fit(X, Y)
>>> print clf.feature_importances_
[ 0.2 0.1 0.1 0. ]
>>> X = [[3,1,2,0], [7,5,6,4]]
>>> clf = clf.fit(X, Y)
>>> print clf.feature_importances_
[ 0.2 0.1 0.1 0. ]
Assume the features have names.
When I shuffle/change the listed order of features specified in the training data set, the importance for each feature changes.
That means the resulted random forest classifier also changes.
Note that I have rule out the effect of randomness, by fixing the random seed.
Why does the listed order of features specified in the data set matter to the random forest classifier, given that the random seed is fixed? Thanks.