Chang, C-Y.
2009-Aug-13 06:22 UTC
[R] When using randomForest, what's the effect to "set.seed"?
Greetings, When reading the random forest manual by Liaw, in the examples "set.seed" is always used before building a forest. Does it matter if I don't set the seed? If I set a different seed manually each time I build a forest, will this give better randomness? Thank you all in advance! -- ===================EcoInformatics Lab http://homepage.ntu.edu.tw/~complex/ecoinformatics_c.html ===================Chun-yi Chang "Ted" Ecoinformatics Lab Institute of Oceanography www.oc.ntu.edu.tw National Taiwan University Tel : +886-2-3366-9746
Daniel Malter
2009-Aug-13 14:27 UTC
[R] When using randomForest, what's the effect to "set.seed"?
if you set a seed manually, it makes the results reproducible. That is, if you set a specific seed, your randomForest procedure should produce the exact same result every time (all others equal). As an example: set.seed(1234) rnorm(100) rnorm(100) set.seed(4531) rnorm(100) rnorm(100) set.seed(1234) rnorm(150) rnorm(150) Note that the last two random-normal draws (with seed 1234), even though they are longer, reproduce the first 100 digits of the first two draws. Without knowing the random forest library, I would think that the new seed is set everytime to make sure that you don't draw one unlucky seed, but that indeed setting different seeds aims at assuring "better randomness," as you suggest. Best, Daniel Chang, C-Y. wrote:> > Greetings, > > When reading the random forest manual by Liaw, in the examples > "set.seed" is always used before building a forest. > Does it matter if I don't set the seed? > If I set a different seed manually each time I build a forest, will this > give better randomness? > > Thank you all in advance! > > -- > ===================> EcoInformatics Lab > http://homepage.ntu.edu.tw/~complex/ecoinformatics_c.html > ===================> Chun-yi Chang "Ted" > Ecoinformatics Lab > Institute of Oceanography > www.oc.ntu.edu.tw > National Taiwan University > Tel : +886-2-3366-9746 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://www.nabble.com/When-using-randomForest%2C-what%27s-the-effect-to-%22set.seed%22--tp24952511p24954825.html Sent from the R help mailing list archive at Nabble.com.