[Rd] Randomness not due to seed
Mike Marchywka
marchywka at hotmail.com
Wed Jul 20 02:01:14 CEST 2011
----------------------------------------
> Date: Tue, 19 Jul 2011 06:13:01 -0700
> From: jeroen.ooms at stat.ucla.edu
> To: r-devel at r-project.org
> Subject: [Rd] Randomness not due to seed
>
> I am working on a reproducible computing platform for which I would like to
> be able to _exactly_ reproduce an R object. However, I am experiencing
> unexpected randomness in some calculations. I have a hard time finding out
> exactly how it occurs. The code below illustrates the issue.
>
> mylm1 <- lm(dist~speed, data=cars);
> mylm2 <- lm(dist~speed, data=cars);
> identical(mylm1, mylm2); #TRUE
>
> makelm <- function(){
> return(lm(dist~speed, data=cars));
> }
>
> mylm1 <- makelm();
> mylm2 <- makelm();
> identical(mylm1, mylm2); #FALSE
>
> When inspecting both objects there seem to be some rounding differences.
> Setting a seed does not make a difference. Is there any way I can remove
> this randomness and exactly reproduce the object every time?
I don't know if anyone had a specific answer for this but in general floating point is not
something for which you want to make bitwise equality tests. You can check the Intel
website for some references but IIRC the FPU can start your calculation with bits or
settings ( flushing denorms to zero for example) left over from the last user although I can't document that.
for example, you can probably find more like this suggesting that changes in alignmnet
and rounding in preamble code can be significant,
http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
and of course if your algorithm is numerically sensitive results could change a lot. Now
its also possible you have unitiliazed or corrupt memory, but you would need to
consider that you will not get bit wise reproduvibility. You can of course go to java
if you really want that LOL.
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Randomness-not-due-to-seed-tp3678082p3678082.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list