[SciPy-Dev] stats, distributions, design choices
Fri Jun 14 09:16:10 CDT 2013
On Fri, Jun 14, 2013 at 10:07 AM, Evgeni Burovski
> Changing all the _argchecks sounds fishy indeed, but since all the pdf-type
> methods call _argcheck anyway, the additional cost would not be large.
> Moreover, extracting `loc` and `scale` and _argcheck-ing can be factored out
> from individual methods to a special method of rv_distrubution. This would
> require a bit of fiddling with the arguments of private methods (_pdf and
> its relatives), but the upshot is that for frozen all this would only be
> done once, at the freezing time.
> What would you say?
Checking at freezing time is just 2 or 3 lines in the freeze method.
That's not a problem.
However, we would have to add the check to all methods, pdf, cdf, ...,
if we want to raise a warning with non-frozen usage. We don't want to
fiddly with the function specific _xxx methods, since they should be
simple and should not include code that is generic, and there are a
huge number of the _xxx methods.
> On Fri, Jun 14, 2013 at 1:44 AM, <firstname.lastname@example.org> wrote:
>> On Thu, Jun 13, 2013 at 7:46 PM, Evgeni Burovski
>> <email@example.com> wrote:
>> >> In general, it's just the pattern that we follow, why do we have nans
>> >> and masked arrays?
>> > That I understand --- I just like signalling NaNs much more than quite
>> > ones,
>> > so was trying to sneak one in.
>> > Anyway, if it doesn't match the usage, it's over; thanks for the
>> > clarification!
>> raising an exception is too drastic as change in behavior/pattern in
>> my opinion, but I'm thinking whether we could issue a special warning.
>> A warning could be set by users to raise an exception.
>> Checking the scale would be easy, that's in one central location.
>> However, checking the shape parameter relies on the individual
>> `_argcheck` and on the calls to them in each method. To change those,
>> we would have to either change all _argchecks which I don't think is a
>> good idea, or to change all methods.
>> In the methods (at least most of them) it would not incur any
>> additional cost to check if there are any invalid parameters, or it
>> would not cost much, depending on where the check is done.
>> (based on what I remember, I didn't check the current code.)
>> I wouldn't be opposed to that, but Ralf is the expert on warnings.
>> > Zhenya
>> > _______________________________________________
>> > SciPy-Dev mailing list
>> > SciPy-Dev@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-dev
>> SciPy-Dev mailing list
> SciPy-Dev mailing list
More information about the SciPy-Dev