Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError in test_gradients #58

Closed
fonnesbeck opened this issue Aug 16, 2011 · 2 comments
Closed

IndexError in test_gradients #58

fonnesbeck opened this issue Aug 16, 2011 · 2 comments
Labels

Comments

@fonnesbeck
Copy link
Member

Two identical failures occur during calls to check_gradients in the test_gradients unit tests:

Traceback (most recent call last):
  File "/Users/fonnescj/Code/pymc/pymc/tests/test_gradients.py", line 286, in test_gradients
    check_gradients(norm2)
  File "/Users/fonnescj/Code/pymc/pymc/tests/test_gradients.py", line 107, in check_gradients
    numeric_gradient = get_numeric_gradient(stochastics, s)
  File "/Users/fonnescj/Code/pymc/pymc/tests/test_gradients.py", line 134, in get_numeric_gradient
    delta[unravel_index(i,i_shape or (1,))] += e
IndexError: 0-d arrays can only use a single () or a list of newaxes (and a single ...) as an index

Also occurs on line 360 of test_gradients.

@fonnesbeck
Copy link
Member Author

I dealt with the IndexError (commit 9988ebb), but the gradient assertion does not appear to fare well:

======================================================================
FAIL: test_gradients (pymc.tests.test_gradients.test_gradients)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fonnescj/Code/pymc/pymc/tests/test_gradients.py", line 291, in test_gradients
    check_gradients(gamma)
  File "/Users/fonnescj/Code/pymc/pymc/tests/test_gradients.py", line 112, in check_gradients
    " is not correct.")
  File "/Library/Python/2.7/site-packages/numpy-2.0.0.dev_730b861_20110815-py2.7-macosx-10.7-x86_64.egg/numpy/testing/utils.py", line 799, in assert_array_almost_equal
    header=('Arrays are not almost equal to %d decimals' % decimal))
  File "/Library/Python/2.7/site-packages/numpy-2.0.0.dev_730b861_20110815-py2.7-macosx-10.7-x86_64.egg/numpy/testing/utils.py", line 635, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 4 decimals
analytic gradient for gamma with respect to parameter a is not correct.
(mismatch 100.0%)
 x: array([-0.96673602, -1.41302081, -2.3154314 , -2.84824608, -1.73328374])
 y: array([-0.54395252, -0.99024297, -1.89264995, -2.42546566, -1.31050626])

@fonnesbeck
Copy link
Member Author

This error seems to have gone away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant