allenai / deep_qa

A deep NLP library, based on Keras / tf, focused on question answering (but useful for other NLP too)
Apache License 2.0
404 stars 132 forks source link

Added Verb semantics instance and corresponding test cases #358

Closed bhavanadalvi closed 7 years ago

bhavanadalvi commented 7 years ago

I incorporated all your comments. I could not fix following test-case: test_convert_instance_to_indexed_instance

I can see that both values in line #90 are same, still the following check fails: assert_array_almost_equal(train_labels, expected_label)

Can you please check the code for as_training_data, and test_convert_instance_to_indexed_instance?

===========================================================

  assert_array_almost_equal(train_labels, expected_label)

E ValueError: E error during assertion: E
E Traceback (most recent call last): E File "/Users/bhavanad/anaconda/lib/python3.5/site-packages/numpy/testing/utils.py", line 720, in assert_array_compare E val = safe_comparison(x, y) E File "/Users/bhavanad/anaconda/lib/python3.5/site-packages/numpy/testing/utils.py", line 665, in safecomparison E return comparison(*args, **kwargs) E File "/Users/bhavanad/anaconda/lib/python3.5/site-packages/numpy/testing/utils.py", line 910, in compare E z = z.astype(float) # handle object arrays E ValueError: setting an array element with a sequence. E
E
E Arrays are not almost equal to 6 decimals E x: array([array([1], dtype=int32), E array([[0, 1], E [1, 0], E [1, 0]], dtype=int32)], dtype=object) E y: array([array([1], dtype=int32), E array([[0, 1], E [1, 0], E [1, 0]], dtype=int32)], dtype=object)

tests/data/instances/sequence_tagging/verb_semantics_instance_test.py:90: ValueError

DeNeutoy commented 7 years ago

Nice - I think the error you are getting is because numpy is trying to convert your data format into an array when it does assert_array_almost_equal, but it can't because it isn't square. Instead, just check the two elements individually - eg:

assert_array_almost_equal(train_labels[0], expected_label[0])
assert_array_almost_equal(train_labels[1], expected_label[1])
bhavanadalvi commented 7 years ago

arghhh.... Thanks Mark for pointing that out, will fix this :P

On Wed, May 17, 2017 at 9:06 AM, Mark Neumann notifications@github.com wrote:

Nice - the error you are getting is because numpy is trying to convert your data format into an array when it does assert_array_almost_equal, but it can't because it isn't square. Instead, just check the two elements individually - eg:

assert_array_almost_equal(train_labels[0], expected_label[0]) assert_array_almost_equal(train_labels[1], expected_label[1])

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allenai/deep_qa/pull/358#issuecomment-302138942, or mute the thread https://github.com/notifications/unsubscribe-auth/AKc_2WCsY571PzSUMPgR4-oopv6xmVKhks5r6xr-gaJpZM4Nbzy8 .

bhavanadalvi commented 7 years ago

All test cases are running fine now, and zero pylon errors. Please check if the PR looks fine :-)

bhavanadalvi commented 7 years ago

I "meant zero pylint errors"