set.seed in function vs clusterSetRNGStream: switching from one to another
0
0
Entering edit mode
ZheFrench ▴ 60
@zhefrench-11689
Last seen 18 months ago
France

I was using set.seed inside a function of my package.
I realized then it was not recommended as a good practice.
Due to the use of parallelization , set.seed was ineficient when calling from the main script.
So I switch to clusterSetRNGStream and now it seems to work well without including set.seed in the function of the package.

Still I am not able to reproduce the exact same sampling with clusterSetRNGStream .

I was using set.seed (9832) directly inside my package and then I tried to reproduce the results using same seed (see code that follows).
Any idea how I could reproduce using the same exact same sampling from set.seed (9832) using clusterSetRNGStream ?

n.proc <- 2
cl     <- makeCluster(n.proc)
clusterSetRNGStream(cl, iseed = 9832)
registerDoParallel(cl)

# Then I'm Calling Package functions...
parallel seed • 644 views
ADD COMMENT

Login before adding your answer.

Traffic: 1106 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6