Random number generation and testing across different OS's.
I have written a differential evolution optimiser that i use for curvefitting. As a genetic optimisation technique it is stochastic and relies heavily on random number generators to do the minimisation. As part of the module tests I would like to write a cross-platform test that checks if the fitting is being done correctly. I use an instance of numpy.random.RandomState for the generation. If I use the seed method on a single platform I get the same output, which I could use to write a test. However, I am unsure of how the seeding and RandomState works across platforms. If I use the same seed on OSX/Windows/Linux, will I get the same stream of random numbers being generated? I need to know if the test I write works across platforms. regards, Andrew. -- _____________________________________ Dr. Andrew Nelson _____________________________________
On Fri, 2013-04-12 at 10:50 -0400, Andrew Nelson wrote:
I have written a differential evolution optimiser that i use for curvefitting. As a genetic optimisation technique it is stochastic and relies heavily on random number generators to do the minimisation. As part of the module tests I would like to write a cross-platform test that checks if the fitting is being done correctly. I use an instance of numpy.random.RandomState for the generation. If I use the seed method on a single platform I get the same output, which I could use to write a test. However, I am unsure of how the seeding and RandomState works across platforms. If I use the same seed on OSX/Windows/Linux, will I get the same stream of random numbers being generated? I need to know if the test I write works across platforms.
Hi, yes, you can be certain of that. NumPy does exactly this for its test as well. Regards, sebastian
regards, Andrew.
-- _____________________________________ Dr. Andrew Nelson
_____________________________________ _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Fri, Apr 12, 2013 at 8:20 PM, Andrew Nelson <andyfaff@gmail.com> wrote:
I have written a differential evolution optimiser that i use for curvefitting. As a genetic optimisation technique it is stochastic and relies heavily on random number generators to do the minimisation. As part of the module tests I would like to write a cross-platform test that checks if the fitting is being done correctly. I use an instance of numpy.random.RandomState for the generation. If I use the seed method on a single platform I get the same output, which I could use to write a test. However, I am unsure of how the seeding and RandomState works across platforms. If I use the same seed on OSX/Windows/Linux, will I get the same stream of random numbers being generated? I need to know if the test I write works across platforms.
Modulo bugs, if you are using the same exact version of numpy on all platforms, you should be getting the same output bytes from the same seed. Some of the distributions may have some differences between 32-bit and 64-bit in some rare cases where a C long would overflow on the 32-bit platform but won't on a 32-bit platform, but those are usually indicative of bugs to be fixed. -- Robert Kern
Hi Andrew, Am 12.04.13 11:50, schrieb Andrew Nelson:
I have written a differential evolution optimiser that i use for curvefitting. As a genetic optimisation technique it is stochastic and relies heavily on random number generators to do the minimisation. As part
out of curiosity I would like to know for what type of problems/models you need DE or why do you think it is superior to gradient based minimizers? Btw., are you aware of ecspy (https://code.google.com/p/ecspy/)? I used it same years ago and found it very powerful. Regards, Christian
participants (4)
-
Andrew Nelson -
Christian K. -
Robert Kern -
Sebastian Berg