see http://scipy.org/scipy/numpy/ticket/921
I think I found the error http://scipy.org/scipy/numpy/browser/trunk/numpy/random/mtrand/distributions.c {{{ 805 /* this is a correction to HRUA* by Ivan Frohne in rv.py */ 806 if (good > bad) Z = m - Z; }}} Quickly looking at the referenced program, downloaded from: http://pal.ece.iisc.ernet.in/~dhani/frohne/rv.py Notation: alpha = bad, beta = good: {{{ if alpha > beta: # Error in HRUA*, this is correct. z = m - z }}} As you can see, if my interpretation is correct, then line 806 should have good and bad reversed, i.e. {{{ 806 if (bad > good) Z = m - Z; }}} Can you verify this? I never tried to build numpy from source. Josef On Sep 25, 4:18 pm, joep <[EMAIL PROTECTED]> wrote: > In my fuzz testing of scipy stats, I get sometimes a test failure. I > think there is something > wrong with numpy.random.hypergeometric for some cases: > > Josef > > >>> import numpy.random as mtrand > >>> mtrand.hypergeometric(3,17,12,size=10) # there are only 3 good balls in > >>> urn > > array([16, 17, 16, 16, 15, 16, 17, 16, 17, 16])>>> > mtrand.hypergeometric(17,3,12,size=10) #negative result > > array([-3, -4, -3, -4, -3, -3, -4, -4, -5, -4]) > > >>> mtrand.hypergeometric(4,3,12,size=10) > >>> np.version.version > > '1.2.0rc2' > > I did not find any clear pattern when trying out different parameter > values: > > >>> mtrand.hypergeometric(10,10,12,size=10) > > array([5, 6, 4, 4, 8, 5, 4, 6, 7, 4])>>> > mtrand.hypergeometric(10,10,20,size=10) > > array([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])>>> > mtrand.hypergeometric(10,10,19,size=10) > > array([10, 9, 9, 9, 9, 9, 10, 9, 9, 9])>>> > mtrand.hypergeometric(10,10,5,size=10) > > array([3, 5, 2, 2, 1, 2, 2, 4, 3, 1])>>> mtrand.hypergeometric(10,2,5,size=10) > > array([4, 5, 4, 5, 5, 5, 4, 3, 4, 4])>>> mtrand.hypergeometric(2,10,5,size=10) > > array([0, 2, 1, 0, 2, 2, 1, 1, 1, 1]) > > >>> mtrand.hypergeometric(17,3,12,size=10) > > array([-5, -3, -4, -4, -4, -3, -4, -4, -3, -3])>>> > mtrand.hypergeometric(3,17,12,size=10) > > array([15, 16, 17, 16, 15, 16, 15, 15, 17, 17])>>> > mtrand.hypergeometric(18,3,12,size=10) > > array([-5, -6, -6, -4, -4, -4, -5, -3, -5, -5]) > > >>> mtrand.hypergeometric(18,3,5,size=10) > > array([4, 5, 5, 5, 5, 5, 4, 5, 4, 3])>>> > mtrand.hypergeometric(18,3,19,size=10) > > array([1, 1, 2, 1, 1, 1, 1, 3, 1, 1]) > _______________________________________________ > Numpy-discussion mailing list > [EMAIL PROTECTED]://projects.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion