[SciPy-user] Inconsistent standard deviation and variance implementation in scipy vs. scipy.stats

Pauli Virtanen pav at iki.fi
Thu Sep 25 04:38:19 EDT 2008


Wed, 24 Sep 2008 16:35:45 -0400, Anne Archibald wrote:
> 2008/9/24 Alan G Isaac <aisaac at american.edu>:
>> On 9/24/2008 12:05 PM Pierre GM apparently wrote:
>>> I think the default to biased estimates was kept for backward
>>> compatibility.
>>
>> It is still a problem that scip.var and scipy.stats.var behave
>> differently (and even have a different signature). What is the way
>> forward?
>>
>> An opening suggestion:
>> unify the signature, let ``bias`` be a deprecated way to to set
>> ``ddof``, and warn users of scipy.stats.var (or std) if they do not set
>> ``ddof``.
> 
> How about (possibly in addition to your suggestion) deprecating the
> re-exporting of numpy functions inside scipy? People often seem to ask
> about whether they should be using the scipy "version" or the numpy
> "version" of some function, when in fact it's just a re-exporting of the
> name.

The opposite direction would be completely removing `var` from 
scipy.stats. Is there a reason why the function is reimplemented in 
scipy? There's probably need eg. for float -> complex casting sqrt(), but 
I don't clearly see why there are two variants of `var`.

Personally, I'd prefer not to have the same function reimplemented in two 
places, unless there is a clear need for it. I think there are more 
examples of duplication / signature mismatches in scipy vs. numpy that 
could be cleaned up a bit, at least in scipy.linalg.

-- 
Pauli Virtanen




More information about the SciPy-User mailing list