[Numpy-discussion] Try this, new tests for numpy.random

Vincent Davis vincent@vincentdavis....
Sat Jun 26 17:24:49 CDT 2010


I added a set of simple testes for numpy.random. These test only test
that you get results and that they are stable. (see attachment)
That said I get several errors (see below) as a result I assume of how
the resent enthought 6.2 beta does the calculation (The tests results
are from numpy running of 3.1)

I think it would be a good idea if several others ran the test to see
if there are other problems or if it is actually stable across
versions.
Any other feedback

Vincent


SUMMARY OF UNIT TEST RESULTS
============================

FAILED TESTS
------------

* TestRandomDist.test_lognormal -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[  1.81865312,   0.07476378],
       [  0.51747188,   0.61901346],
       [ 44.09839408,   0.35777415]])
 y: array([[ 16.50698632,  36.54846706],
       [ 22.678866  ,   0.71617561],
       [ 65.72798502,  86.84341601]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 272
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_multivariate_normal -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 50.0%)
 x: array([[[ -0.15876548,  10.        ],
        [  0.58858952,  10.        ]],
...
 y: array([[[ -1.47027513,  10.        ],
        [ -1.65915082,  10.        ]],
...
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 305
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_negative_binomial -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not equal

(mismatch 100.0%)
 x: array([[702, 777],
       [692, 646],
       [630, 806]])
 y: array([[848, 841],
       [892, 611],
       [779, 647]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 313
              np.testing.assert_array_equal(actual, desired)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
677
                               verbose=verbose, header='Arrays are not equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_noncentral_chisquare -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[  5.42550628,   3.68327961],
       [  7.8305713 ,   5.45961594],
       [ 10.68988949,   5.17932387]])
 y: array([[ 23.91905354,  13.35324693],
       [ 31.22452661,  16.60047399],
       [  5.03461598,  17.94973089]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 321
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_noncentral_f -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[   1.41010542,  106.52208522],
       [   1.35761411,   45.00197918],
       [   9.97943281,   13.86047453]])
 y: array([[ 1.405981  ,  0.34207973],
       [ 3.57715069,  7.92632663],
       [ 0.43741599,  1.17742088]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 330
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_normal -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 0.59809618, -2.59342171],
       [-0.6588001 , -0.47962827],
       [ 3.78642337, -1.02785335]])
 y: array([[ 2.8037837 ,  3.59863924],
       [ 3.12143348, -0.33382988],
       [ 4.18552479,  4.46410668]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 338
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_rand -- test_random.py (numpy-vmd-dev/numpy/random/tests)
    NameError: global name 'array' is not defined
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 113
              desired1 = array([[ 0.61879477158567997,  0.59162362775974664],

* TestRandomDist.test_randint -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AttributeError: 'module' object has no attribute 'randint'
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 129
              actual = np.randint(-99, 99, size=(3,2))

* TestRandomDist.test_randn -- test_random.py (numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 0.2373197 , -1.35843925],
       [-0.39112844, -0.30154253],
       [ 1.83148329, -0.57565507]])
 y: array([[ 1.34016346,  1.73759123],
       [ 1.49898834, -0.22864333],
       [ 2.031034  ,  2.17032495]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 125
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_standard_cauchy -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[-0.17470026,  1.29709215],
       [-3.18156373, -0.45005445],
       [-0.46997791, -1.57823221]])
 y: array([[ 0.7712766 , -6.55601162],
       [ 0.93582023, -2.07479293],
       [-4.74601644,  0.18338989]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 378
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_standard_gamma -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 3.0732848 ,  1.30782909],
       [ 3.57713935,  0.9544672 ],
       [ 1.09782087,  3.73036312]])
 y: array([[ 5.50841531,  6.6295347 ],
       [ 5.93988485,  2.31044849],
       [ 7.54838614,  8.01275609]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 394
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_standard_normal -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 0.2373197 , -1.35843925],
       [-0.39112844, -0.30154253],
       [ 1.83148329, -0.57565507]])
 y: array([[ 1.34016346,  1.73759123],
       [ 1.49898834, -0.22864333],
       [ 2.031034  ,  2.17032495]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 402
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_standard_t -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 0.34958651, -0.07515709],
       [-0.36478493, -0.16467516],
       [ 0.65905206, -1.33550263]])
 y: array([[ 0.97140612, -0.08830487],
       [ 1.36311144, -0.55317464],
       [-0.18473749,  0.61181537]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 410
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

* TestRandomDist.test_wald -- test_random.py (numpy-vmd-dev/numpy/random/tests)
    AssertionError:
Arrays are not almost equal

(mismatch 100.0%)
 x: array([[ 0.99532782,  0.5024266 ],
       [ 0.78691891,  0.37161609],
       [ 0.42210803,  0.73660839]])
 y: array([[ 3.82935266,  5.13125249],
       [ 0.35045404,  1.50832397],
       [ 0.2412432 ,  0.22031101]])
      unittest.py
(/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6): 279
                      testMethod()
      test_random.py (numpy-vmd-dev/numpy/random/tests): 444
              np.testing.assert_array_almost_equal(actual, desired, decimal=15)
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
765
                               header='Arrays are not almost equal')
      utils.py (/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing):
609
                      raise AssertionError(msg)

PASSED TESTS
------------

* TestMultinomial.test_basic -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestMultinomial.test_int_negative_interval -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestMultinomial.test_zero_probability -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_beta -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_binomial -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_bytes -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_chisquare -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_dirichlet -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_exponential -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_f -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_gamma -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_geometric -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_gumbel -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_hypergeometric -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_laplace -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_logistic -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_logseries -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_multinomial -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_pareto -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_poisson -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_power -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_random_integers -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_random_sample -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_rayleigh -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_shuffle -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_standard_exponential -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_triangular -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_uniform -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_vonmises -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_weibull -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRandomDist.test_zipf -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestRegression.test_VonMises_range -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRegression.test_hypergeometric_range -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestRegression.test_logseries_convergence -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestSetState.test_backwards_compatibility -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestSetState.test_basic -- test_random.py (numpy-vmd-dev/numpy/random/tests)
* TestSetState.test_gaussian_reset -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestSetState.test_gaussian_reset_in_media_res -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
* TestSetState.test_negative_binomial -- test_random.py
(numpy-vmd-dev/numpy/random/tests)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_random.py
Type: application/octet-stream
Size: 20926 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100626/898fae65/attachment-0001.obj 


More information about the NumPy-Discussion mailing list