[SciPy-dev] Fwd: tests and partial patch forscipy.stats.distributions

josef.pktd@gmai... josef.pktd@gmai...
Thu Oct 2 08:29:48 CDT 2008


I finally filed a ticket on this on scipy trac:
http://scipy.org/scipy/scipy/ticket/745

On Wed, Oct 1, 2008 at 7:14 AM,  <Per.Brodtkorb@ffi.no> wrote:
> I have looked into the bugs in the patch of the discrete distributions you sent. The error in _ppf method of dlaplace can be corrected by replacing it with:
>
> class dlaplace_gen(rv_discrete):
> .....
>    def _ppf(self, q, a):
>        const = 1.0/(1+exp(-a))
>        cons2 = 1+exp(a)
>        ind = q < const
>        return ceil(where(ind, log(q*cons2)/a-1, -log((1-q)*cons2)/a))
> ......
>

Thanks, I didn't see the misplaced bracket, I changed my corrections
to this. Do you have any idea or reference about the theoretical
second moment of dlaplace?


> The tests written for the generic moment, fails for those distributions that set the limits (self.a and/or self.b) for the support of the distribution in the self._argcheck method. I think the generic_moment method is meant to be private to the self._munp method, since it does only limited input checks.
> Perhaps better to rename generic_moment to _generic_moment

I aggree, I didn't check this systematically, but I guess
'vec_generic_moment', 'vecentropy' are also private methods.
>
> Per A.

I did not realize that some of my tests on private methods might fail
for some distributions by design.
To make it a bit clearer, I separated the tests into tests for public
methods, and tests for private methods. I still like the tests of
private methods, even if some are known failures, since they help to
narrow down what the source of an exception or test failure in the
public methods is.

Josef


More information about the Scipy-dev mailing list