-
-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching and reproducibilty: globally setting random seed #274
Comments
I'll think about it. I have a very different opinion with the majority of people on |
:) On 14/06/2012 06:47, Yihui Xie wrote:
|
Yes I understand that. I'm at useR!2012 this week, and I'll try to find out an optimal way to solve this issue when I go back. Thanks! |
This is really a tricky issue. The root reason is that RNG (random number generation) modifies That is why I said in NEWS that if you want perfect reproducibility, you must |
OK, I've got an idea on how to solve this issue: when the |
Done. Caching random see should be safe if you read the last section of http://yihui.name/knitr/demo/cache/ |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Hi,
I saw on the NEWS file that you changed the way cache interact with
.Random.seed
.I am sure there is a technical reason for the change, but the result is in my opinion really not practical (i.e. specifying
set.seed
in each cached chunk). What is preventing from restoring the random seed as after a cached computation?To me this jeopardizes the reproducibility of knit documents.
e.g., the following chunks give different results if run twice, due to caching. Worse: the same random seed is used in both computation.
set.seed(1234)
Result for first run is:
set.seed(1234)
x
runif(3)
runif(3)
The second run gives:
set.seed(1234)
x
runif(3)
runif(3)
The text was updated successfully, but these errors were encountered: