# Does running a Decision Tree classifier several times help?

To introduce, I am a novice in ML techniques. I recently had to write a scikit-learn based decision tree classifier to train on a real dataset. Someone suggested me that I must run mu model several thousand times and plot the accuracies on a graph. Here's the rub: I manually ran it around 20 -30 times and every time it gave the same accuracy (for both gini and entropy base). Is that wrong? Should it show slight variations every time?

The scikit-learn DecisionTreeClassifier takes a parameter called random_state. If this is set to an integer, your model should produce the same results every time.

The person suggesting you run the model many times would be correct, assuming you allow for no set random state. This means the results should be slightly different every time, because there is some random selection going on in the algorithm. Here is an example from the splitter classes:

# Draw a feature at random
f_j = rand_int(n_drawn_constants, f_i - n_found_constants,
random_state)


If are are not setting that random state (or any other kind of random seed), I am not sure off the top of my head, why or how the results would always be identical.

• I allow a fixed random state, I guess that's why the decision tree keeps giving me same results. For no random state, do I just use a random number generator there or is there any parameter to do that for me? – Jishan Aug 24 '18 at 12:08
• If you leave the random_state parameter with the default value (None), each run will get a random random state, so there is nothing additional for you to do! :-) – n1k31t4 Aug 24 '18 at 12:42