[Numpy-discussion] Reminder: code freeze for bet at the end of the WE
Charles R Harris
Sat Mar 14 13:37:32 CDT 2009
On Sat, Mar 14, 2009 at 12:14 PM, <email@example.com> wrote:
> On Sat, Mar 14, 2009 at 1:52 PM, David Cournapeau <firstname.lastname@example.org>
> > On Sun, Mar 15, 2009 at 2:40 AM, Charles R Harris
> > <email@example.com> wrote:
> >> The fixes look small and I'd like them to go in. Can you put together
> >> short tests for these fixes? Would it help if you had commit privileges
> >> 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
I can verify that these currently fail on my machine. I'll make regression
tests out of them and then commit the fixes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion