Why the result of Random Forest Algorithm change a lot when all the parameters are kept the same? I want to do some classification of some dataset with random forest. When I run the same script twice, two totally different(almost 5%) result were given by the program. I want to know whether random forest always give the result that change a lot with the same parameters? How can I make it more stable?
 A: The Random Forest algorithm involves a lot of randomization, as I assume you know (right?). So you will get somewhat different results each time you run it.
To obtain reproducible results, which is a good idea, initialize your random number generator with a fixed number. In R, you can do this with set.seed(1), or with whatever other seed you want.
Be sure to investigate the effects of changing this seed, i.e., how sensitive your results are to your specific random number stream.
A: I was facing the same problem when running the Random Forest code. I wonder if this problem is already solved or not, but I found this source of the latest sklearn's glossary of Random Forest (https://scikit-learn.org/stable/glossary.html#:~:text=value%20may%20be%3A-,None%20(default),-Use%20the%20global).
Based on the source, we should set the "random_state" parameter (0 or 42)in order to make the model reproducible. Otherwise, the random_state will be set as None and the output models will always be different.
