[SciPy-Dev] ANN: SciPy 0.8.0 beta 1

josef.pktd at gmail.com josef.pktd at gmail.com
Sat Jun 12 15:22:46 EDT 2010


On Sat, Jun 12, 2010 at 3:02 PM, Vincent Davis <vincent at vincentdavis.net> wrote:
> On Fri, Jun 11, 2010 at 6:41 PM,  <josef.pktd at gmail.com> wrote:
>> On Fri, Jun 11, 2010 at 7:54 PM, Derek Homeier
>> <derek at 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

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 at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list