[SciPy-Dev] seeded randn gets different values on osx

josef.pktd@gmai... josef.pktd@gmai...
Sun Jun 13 10:05:51 CDT 2010


On Sun, Jun 13, 2010 at 10:57 AM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
>
> On Sat, Jun 12, 2010 at 10:06 PM, <josef.pktd@gmail.com> wrote:
>>
>> On Sat, Jun 12, 2010 at 10:09 PM, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>> >
>> >
>> > On Sat, Jun 12, 2010 at 7:44 PM, Vincent Davis
>> > <vincent@vincentdavis.net>
>> > wrote:
>> >>
>> >> There was another tread (scipy 8.0b release) describing a problem with
>> >> FAIL: test_stats.test_kstest see full test fail below.
>> >>
>> >> After a little discusion with Josef here are some results. It appears
>> >> to me that osx gets different values from a seeded randn
>> >>
>> >> >From Josef, I assume windows
>> >> >>>>> np.random.seed(0)
>> >> >>>>> np.random.randn(3)
>> >> >> array([ 1.76405235,  0.40015721,  0.97873798])
>> >> >
>> >> On my machine OSX py 2.6.5, numpy 1.4.0 scipy 8.0b
>> >> >>>> np.random.seed(0)
>> >> >>>> np.random.randn(3)
>> >> > array([ 0.06897149,  1.32078057,  1.5997924 ])
>> >>
>> >> ubuntu 10.0.4  py 2.5.6 current scipy and numpy just built from the git
>> >> source.
>> >> >>> np.random.seed(0)
>> >> >>> np.random.randn(3)
>> >> array([ 1.76405235,  0.40015721,  0.97873798])
>> >>
>> >> FAIL: test_stats.test_kstest
>> >> ----------------------------------------------------------------------
>> >> Traceback (most recent call last):
>> >>  File
>> >>
>> >> "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/nose/case.py",
>> >> line 186, in runTest
>> >>   self.test(*self.arg)
>> >>  File
>> >>
>> >> "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/scipy/stats/tests/test_stats.py",
>> >> line 1228, in test_kstest
>> >>   assert_almost_equal( D, 0.12464329735846891, 15)
>> >>  File
>> >>
>> >> "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing/utils.py",
>> >> line 459, in assert_almost_equal
>> >>   raise AssertionError(msg)
>> >> AssertionError:
>> >> Arrays are not almost equal
>> >>  ACTUAL: 0.093893737596468518
>> >>  DESIRED: 0.12464329735846891
>> >> ______
>> >
>> > There were some changes to the random normal generator in trunk, but I
>> > don't
>> > think they should affect this. What versions of numpy is everyone using?
>>
>> I'm also using numpy 1.4.0, but the results for the random numbers in
>> the tests have been hard coded for 19 months ( numpy 1.3.0 ?)
>>
>> OS X 10.5 ppc:darwin-ppc in 0.7.2 and 0.8.0b1 numpy 1.4.1(?) has a
>> small divergence 10e-13 (Derek Homeier)
>>
>> OSX py 2.6.5, numpy 1.4.0 scipy 8.0b is pretty far off  (Vincent)
>>
>> This is a numpy issue that shows up in stats because of the tests.
>>
>
> I don't see anything obvious in the revision history. Does the uniform
> distribution also show changes? It is also possible that compiler
> optimizations are messing with the code, unlikely, but it would be nice to
> know the compiler versions used and/or 64 bits vs 32 bits. There is at least
> one numpy test that depends on random numbers from a given seed being
> reproducible and it isn't showing any problems. Sounds like we need to add a
> test specifically to test reproducibility.

we only compared randn and rand across machines,

random.rand has identical results on Vincent's and my computers

Josef


>
> Chuck
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>


More information about the SciPy-Dev mailing list