xwhan / DeepPath

code and docs for my EMNLP paper "DeepPath: A Reinforcement Learning Method for Knowledge Graph Reasoning"
529 stars 135 forks source link

Error in executing link_prediction_eval.sh #9

Closed bagindokemas closed 5 years ago

bagindokemas commented 5 years ago

Hi Wenhan,

I found this error when running this command ./link_prediction_eval.sh concept_athletehomestadium (I run it in a CPU server that has Python 2.7, Keras, and Tensorflow).

Using TensorFlow backend. 11 How many paths used: 11 evaluate.py:42: UserWarning: The nb_epoch argument in fit has been renamed epochs. model.fit(training_features, train_labels, nb_epoch=300, batch_size=128) Traceback (most recent call last): File "evaluate.py", line 260, in evaluate_logic() File "evaluate.py", line 108, in evaluate_logic model = train(kb, kb_inv, named_paths) File "evaluate.py", line 42, in train model.fit(training_features, train_labels, nb_epoch=300, batch_size=128) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 952, in fit batch_size=batch_size) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 751, in _standardize_user_data exception_prefix='input') File "/usr/local/lib/python2.7/dist-packages/keras/engine/training_utils.py", line 102, in standardize_input_data str(len(data)) + ' arrays: ' + str(data)[:200] + '...') ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 4867 arrays: [array([[0], [0], [0], [0], [0], [0], [0], [1], [1], [1], [1]]), array([[0], [0], [0], [0], [0], ... Is this was caused by the Keras Library? The transR_eval.py, transE_eval.py, transX_eval.py worked fine.
Could you advise me how to solve this?

Thank you very much.

bagindokemas commented 5 years ago

After trying and googling, I found out the way to solve this issue. Just put np.array before the training_features and train_labels parameter. After that, the link prediction code work.