[Numpy-discussion] Reminder: code freeze for bet at the end of the WE

josef.pktd at gmail.com josef.pktd at gmail.com
Sat Mar 14 14:14:25 EDT 2009


On Sat, Mar 14, 2009 at 1:52 PM, David Cournapeau <cournape at gmail.com> wrote:
> On Sun, Mar 15, 2009 at 2:40 AM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
>
>>
>> The fixes look small and I'd like them to go in. Can you put together some
>> short tests for these fixes? Would it help if you had commit privileges in
>> Numpy?
>
> Yes, I was about to suggest giving Josef commit access to numpy, I
> unfortunately won't have much time to do anything but release tasks in
> the next few days, including review. If someone else (you :) ) can
> review the changes, before they go in, then there is no reason why
> they can't go in - assuming they come in very soon,
>
> David

The correctness of the random numbers are tested in scipy.stats. They
are not tested in np.random.tests.
Currently, I have the test for logser disabled because it always
fails, for hypergeometric, I picked parameters for which the random
numbers are correct. Once the bugs are fixed, I can add or re-enable
the tests for the current failures.

Here are some tests, that should fail with the current trunk and pass
after the fix. I don't have an unpatched version of numpy available
right now, but these are the cases that initially showed the bugs. Can
you verify that they fail on current or recent trunk? They don't fail
on my patched version. But it has been some time ago that I did this
and I would need to check the details again if these tests don't fail
on the current trunk.

{{{
import numpy as np

assert np.all(np.random.hypergeometric(3,18,11,size=10) < 4)
assert np.all(np.random.hypergeometric(18,3,11,size=10) > 0)

pr = 0.8
N = 100000
rvsn = np.random.logseries(pr,size=N)
# these two frequency counts should be close to theoretical numbers
with this large sample
assert np.sum(rvsn==1) / float(N) > 0.45   # theoretical:  0.49706795
assert np.sum(rvsn==1) / float(N) < 0.23   # theoretical:  0.19882718
}}}


About commit access: it would be convenient to have it, but not
necessary since there are only a few things that I can contribute to
numpy directly.

Josef



More information about the NumPy-Discussion mailing list