[SciPy-Dev] ANN: SciPy 0.8.0 beta 1

josef.pktd@gmai... josef.pktd@gmai...
Sat Jun 12 15:13:53 CDT 2010


On Sat, Jun 12, 2010 at 4:04 PM, Vincent Davis <vincent@vincentdavis.net> wrote:
> On Sat, Jun 12, 2010 at 2:00 PM,  <josef.pktd@gmail.com> wrote:
>> On Sat, Jun 12, 2010 at 3:50 PM, Vincent Davis <vincent@vincentdavis.net> wrote:
>>> On Sat, Jun 12, 2010 at 1:47 PM,  <josef.pktd@gmail.com> wrote:
>>>> On Sat, Jun 12, 2010 at 3:41 PM, Vincent Davis <vincent@vincentdavis.net> wrote:
>>>>> On Sat, Jun 12, 2010 at 1:37 PM,  <josef.pktd@gmail.com> wrote:
>>>>>> On Sat, Jun 12, 2010 at 3:28 PM, Vincent Davis <vincent@vincentdavis.net> wrote:
>>>>>>> On Sat, Jun 12, 2010 at 1:22 PM,  <josef.pktd@gmail.com> wrote:
>>>>>>>> On Sat, Jun 12, 2010 at 3:02 PM, Vincent Davis <vincent@vincentdavis.net> wrote:
>>>>>>>>> On Fri, Jun 11, 2010 at 6:41 PM,  <josef.pktd@gmail.com> wrote:
>>>>>>>>>> On Fri, Jun 11, 2010 at 7:54 PM, Derek Homeier
>>>>>>>>>> <derek@astro.physik.uni-goettingen.de> wrote:
>>>>>>>>>>> Hi Josef,
>>>>>>>>>>>
>>>>>>>>>>>>> FAIL: test_stats.test_kstest
>>>>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>>>>>  File "/sw/lib/python2.6/site-packages/nose/case.py", line 186, in runTest
>>>>>>>>>>>>>    self.test(*self.arg)
>>>>>>>>>>>>>  File "/sw/lib/python2.6/site-packages/scipy/stats/tests/test_stats.py", line 1078, in test_kstest
>>>>>>>>>>>>>    np.array((0.0072115233216310994, 0.98531158590396228)), 14)
>>>>>>>>>>>>>  File "/sw/lib/python2.6/site-packages/numpy/testing/utils.py", line 441, in assert_almost_equal
>>>>>>>>>>>>>    return assert_array_almost_equal(actual, desired, decimal, err_msg)
>>>>>>>>>>>>>  File "/sw/lib/python2.6/site-packages/numpy/testing/utils.py", line 765, in assert_array_almost_equal
>>>>>>>>>>>>>    header='Arrays are not almost equal')
>>>>>>>>>>>>>  File "/sw/lib/python2.6/site-packages/numpy/testing/utils.py", line 609, in assert_array_compare
>>>>>>>>>>>>>    raise AssertionError(msg)
>>>>>>>>>>>>> AssertionError:
>>>>>>>>>>>>> Arrays are not almost equal
>>>>>>>>>>>>>
>>>>>>>>>>>>> (mismatch 100.0%)
>>>>>>>>>>>>>  x: array([ 0.007,  0.985])
>>>>>>>>>>>>>  y: array([ 0.007,  0.985])
>>>>>>>>>>>>
>>>>>>>>>>>> maybe the precision (decimal 14) is too high for this test across platforms
>>>>>>>>>>>>
>>>>>>>>>>>> Could you check how large the difference is ?
>>>>>>>>>>>>
>>>>>>>>>>>> np.random.seed(987654321)
>>>>>>>>>>>> x = stats.norm.rvs(loc=0.2, size=100)
>>>>>>>>>>>> np.array(stats.kstest(x,'norm', alternative = 'greater')) -
>>>>>>>>>>>>                np.array((0.0072115233216310994, 0.98531158590396228))
>>>>>>>>>>>>
>>>>>>>>>>>> (my line numbers differ, but this should be the right test given your numbers)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> yes, just a decimal or two too high, if I got the numbers right:
>>>>>>>>>>> # OS X 10.5 i386 / 10.6 x86_64:
>>>>>>>>>>> array([  8.67361738e-18,   1.66533454e-15])
>>>>>>>>>>>
>>>>>>>>>>> # OS X 10.5 ppc:
>>>>>>>>>>> array([  2.05955045e-13,  -7.16759985e-13])
>>>>>>>>>>
>>>>>>>>>> interesting that there are differences in the calculations, but for
>>>>>>>>>> the test we can just reduce the precision to decimal=12 to avoid the
>>>>>>>>>> test failure.
>>>>>>>>>
>>>>>>>>> I must be doing something wrong here becuase I don't get anything
>>>>>>>>> close that what you have above.
>>>>>>>
>>>>>>>>> In [4]: np.random.seed(987654321)
>>>>>>>>>
>>>>>>>>> In [5]: x = stats.norm.rvs(loc=0.2, size=100)
>>>>>>>>>
>>>>>>>>> In [6]: r1 = np.array(stats.kstest(x,'norm', alternative = 'greater'))
>>>>>>>>>
>>>>>>>>> In [7]: r2 = np.array((0.0072115233216310994, 0.98531158590396228))
>>>>>>>>>
>>>>>>>>> In [8]: r1-r2
>>>>>>>>> Out[8]: array([ 0.03704986, -0.32866092])
>>>>>>>>
>>>>>>>>>>> np.random.seed(987654321)
>>>>>>>>>>> xrvs = stats.norm.rvs(loc=0.2, size=100)
>>>>>>>>>>> r1 = np.array(stats.kstest(xrvs,'norm', alternative = 'greater'))
>>>>>>>>>>> r2 = np.array((0.0072115233216310994, 0.98531158590396228))
>>>>>>>>>>> r1-r2
>>>>>>>> array([  8.67361738e-18,   1.66533454e-15])
>>>>>>>>
>>>>>>>> Can you check mean and var to see if you have the same random  numbers?
>>>>>>>>
>>>>>>>>>>> xrvs.mean()
>>>>>>>> 0.20830662128271851
>>>>>>>>>>> xrvs.var()
>>>>>>>> 1.1210385272356511
>>>>>>>
>>>>>>> In [11]: x.mean()
>>>>>>> Out[11]: 0.054996065027031464
>>>>>>>
>>>>>>> In [12]: x.var()
>>>>>>> Out[12]: 0.92731406990162746
>>>>>>
>>>>>> looks like you have different random numbers
>>>>>>
>>>>>>>
>>>>>>> I am cheating and using the enthought distribution, I just click install.
>>>>>>> How do I run all of the tests for scipy or numpy when they are already
>>>>>>> installed?
>>>>>>
>>>>>> scipy.stats.test()
>>>>>> .test() works for scipy and every subpackage
>>>>>>
>>>>>> is ipython messing with the RandomState ?
>>>>>
>>>>> In [19]: np.random.seed(987654321)
>>>>>
>>>>> In [20]: np.random.rand(3)
>>>>> Out[20]: array([ 0.07298833,  0.2160365 ,  0.46475349])
>>>>>
>>>>> In [21]: np.random.rand(3)
>>>>> Out[21]: array([ 0.62258994,  0.61838812,  0.42737911])
>>>>
>>>> same here
>>>>
>>>>>>> np.random.seed(987654321)
>>>>>>> np.random.rand(3)
>>>> array([ 0.07298833,  0.2160365 ,  0.46475349])
>>>>>>> np.random.rand(3)
>>>> array([ 0.62258994,  0.61838812,  0.42737911])
>>>>
>>>> ??
>>>
>>> Gets better, I just ran the test, I need to look above to see how this relates.
>>>
>>> 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
>>
>>
>> can you check stats random numbers
>>
>>>>> np.random.seed(987654321)
>>>>> stats.norm.rvs(size=3)
>> array([ 2.24655081, -0.64591822, -1.18357699])
>>>>> np.random.seed(987654321)
>>>>> np.random.randn(3)
>> array([ 2.24655081, -0.64591822, -1.18357699])
>>
>> which numpy, scipy versions?
>
>>>> np.random.seed(987654321)
>>>> stats.norm.rvs(size=3)
> array([-2.35810307,  0.97313103, -0.52004087])
>>>> np.random.seed(987654321)
>>>> np.random.randn(3)
> array([-2.35810307,  0.97313103, -0.52004087])

looks like the np.random.randn implementation differs, but I also have
numpy 1.4.0

maybe a different seed
>>> np.random.seed(0)
>>> np.random.randn(3)
array([ 1.76405235,  0.40015721,  0.97873798])

np.random.rand was the same

I've never seen this and no idea what might be going on, but we won't
be able to use seeded random numbers in tests if this is "real"

Josef
http://www.ruthannzaroff.com/wonderland/curiouser.htm


>
> Obviously different. Not sure how to get the build number from the
> scipy and numpy version.
>
> Vincent
>
>>>> scipy.__version__
> '0.8.0b1'
>>>> import numpy
>>>> numpy.__version__
> '1.4.0'
>
> Vincent
>
>>
>> Josef
>>
>>>
>>> Vincent
>>>
>>>>
>>>> Josef
>>>>>
>>>>> In [22]: np.random.seed(987654321)
>>>>>
>>>>> In [23]: np.random.rand(3)
>>>>> Out[23]: array([ 0.07298833,  0.2160365 ,  0.46475349])
>>>>>
>>>>> Vincent
>>>>>
>>>>>>
>>>>>> Josef
>>>>>>
>>>>>>>
>>>>>>> Vincent
>>>>>>>
>>>>>>>>
>>>>>>>> otherwise I have no clue, (but I guess your scipy.stats tests pass)
>>>>>>>>
>>>>>>>> Josef
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Vincent
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Josef
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>>                                                Derek
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> SciPy-Dev mailing list
>>>>>>>>>>> SciPy-Dev@scipy.org
>>>>>>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> SciPy-Dev mailing list
>>>>>>>>>> SciPy-Dev@scipy.org
>>>>>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> SciPy-Dev mailing list
>>>>>>>>> SciPy-Dev@scipy.org
>>>>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> SciPy-Dev mailing list
>>>>>>>> SciPy-Dev@scipy.org
>>>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> SciPy-Dev mailing list
>>>>>>> SciPy-Dev@scipy.org
>>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>>
>>>>>> _______________________________________________
>>>>>> SciPy-Dev mailing list
>>>>>> SciPy-Dev@scipy.org
>>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>>
>>>>> _______________________________________________
>>>>> SciPy-Dev mailing list
>>>>> SciPy-Dev@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>>
>>>> _______________________________________________
>>>> SciPy-Dev mailing list
>>>> SciPy-Dev@scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>>
>>> _______________________________________________
>>> SciPy-Dev mailing list
>>> SciPy-Dev@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>


More information about the SciPy-Dev mailing list