[SciPy-Dev] scipy.stats

nicky van foreest vanforeest at gmail.com
Sat Apr 21 17:06:06 EDT 2012


>> btw, I am compiling a list of points about the scipy.stats code. Once
>> finished what should I do with it? Would it be best to send it to this
>> list? Should I send the points one by one, or better as one file?
>>
>> I am very enthousiastic about the fact that the code is now easily
>> accessible via the web.
>
> pull request on github?

I have seen this request coming by some time ago. I am happy to see
that it has been implemented.

>
> depends on what the "points" are.
> If you find bugs, individual tickets would be useful. If you find
> several/many smaller things, then one would make it easier to go over
> all of them.

I don't always know whether these points are bugs, or due to my
misunderstanding of the code or the example text. Hence, it is not
always clear to me whether these points are bugs. Here are two
examples that confuse me:


In [11]: from scipy.stats import uniform

In [12]: U = uniform(loc = 3, scale = 5)

In [13]: U.mean()
Out[13]: 5.5

In [14]: U.moment(1)
Out[14]: 0.5

In [15]: U.moment(8)
Out[15]: array(0.11111111111111112)

First point: why in line 14 is U.moment(1)  not equal to U.mean()? I
checked the code on line
https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L358
to see why, and this explains the result. However, from the doc-string
on line https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L129
I would expect to see that U.moment(1) = U.mean().

Second point: From the code I understand that U.moment(1) returns a
float, and that the U.moment(8) returns an array. From a user's
perspective I find this inconsistent, however.

So, are these points real bugs?



More information about the SciPy-Dev mailing list