Dynamic-Memory-Networks-in-TensorFlow
Dynamic-Memory-Networks-in-TensorFlow copied to clipboard
How to convert predicted vector back to natural language?
I have these vectors returned as part of running dmn_test.py after training.
[array([14, 5, 8, 14, 14, 16, 20, 19, 16, 5, 8, 5, 8, 14, 16, 20, 16, 8, 8, 16, 8, 14, 16, 8, 5, 14, 16, 16, 5, 16, 20, 20, 14, 19, 19, 20, 16, 5, 14, 8, 14, 16, 19, 20, 20, 5, 19, 20, 8, 16, 20, 8, 19, 5, 19, 5, 19, 19, 16, 16, 19, 19, 14, 14, 19, 5, 16, 5, 14, 5, 14, 19, 16, 16, 8, 16, 8, 20, 8, 20, 16, 20, 8, 16, 16, 19, 5, 16, 20, 8, 5, 20, 16, 19, 16, 19, 19, 14, 8, 14])] [array([ 5, 19, 19, 19, 16, 19, 20, 16, 14, 14, 16, 5, 5, 14, 19, 20, 20, 19, 14, 20, 8, 8, 5, 20, 14, 20, 8, 20, 19, 20, 16, 5, 14, 20, 16, 5, 20, 5, 20, 16, 8, 8, 5, 14, 5, 20, 8, 16, 19, 20, 8, 16, 5, 20, 8, 20, 8, 20, 19, 19, 5, 8, 20, 14, 19, 5, 5, 19, 20, 14, 5, 5, 19, 8, 14, 16, 20, 5, 16, 8, 19, 14, 8, 8, 8, 8, 5, 16, 19, 20, 14, 20, 20, 20, 16, 16, 14, 14, 5, 8])] [array([ 5, 20, 5, 16, 16, 14, 19, 19, 5, 5, 20, 20, 19, 16, 5, 16, 5, 5, 20, 16, 14, 20, 20, 19, 8, 14, 20, 5, 16, 19, 19, 8, 5, 5, 16, 8, 8, 14, 20, 8, 8, 20, 8, 20, 19, 5, 5, 5, 19, 20, 16, 5, 5, 16, 20, 5, 5, 16, 8, 16, 14, 8, 19, 16, 8, 19, 14, 5, 20, 16, 19, 5, 5, 16, 16, 16, 19, 8, 5, 16, 5, 20, 19, 8, 19, 5, 16, 20, 19, 14, 19, 14, 14, 19, 20, 16, 5, 8, 19, 14])] [array([20, 19, 19, 5, 14, 16, 16, 5, 16, 8, 5, 19, 5, 19, 20, 16, 8, 8, 8, 8, 16, 5, 16, 16, 20, 20, 19, 8, 20, 14, 14, 20, 19, 20, 14, 19, 20, 14, 16, 8, 19, 14, 5, 14, 14, 14, 8, 5, 20, 19, 8, 16, 20, 16, 20, 20, 8, 16, 5, 20, 8, 16, 16, 16, 5, 19, 14, 8, 20, 20, 8, 19, 16, 16, 8, 20, 8, 16, 8, 20, 5, 16, 8, 5, 14, 20, 8, 5, 5, 8, 8, 16, 8, 16, 16, 20, 5, 19, 16, 5])] [array([ 5, 19, 16, 5, 16, 19, 14, 16, 19, 19, 20, 14, 8, 19, 14, 19, 8, 8, 14, 5, 19, 16, 16, 20, 16, 8, 5, 20, 19, 5, 19, 5, 8, 19, 5, 5, 5, 16, 14, 14, 14, 14, 5, 20, 20, 5, 19, 19, 8, 19, 8, 20, 19, 16, 19, 20, 5, 19, 16, 20, 16, 20, 8, 8, 14, 5, 19, 14, 19, 5, 19, 19, 14, 8, 19, 14, 19, 14, 20, 16, 5, 16, 8, 5, 16, 5, 16, 16, 19, 8, 16, 14, 20, 19, 20, 20, 20, 5, 8, 8])] [array([14, 8, 19, 5, 20, 8, 16, 19, 16, 5, 8, 5, 5, 5, 5, 8, 5, 5, 5, 20, 5, 20, 20, 8, 14, 14, 14, 14, 16, 14, 19, 19, 5, 19, 5, 14, 14, 14, 16, 16, 16, 19, 16, 14, 19, 19, 20, 8, 20, 19, 5, 14, 16, 20, 8, 16, 16, 19, 5, 5, 19, 5, 14, 8, 8, 14, 8, 16, 20, 16, 19, 19, 20, 14, 19, 19, 19, 5, 16, 14, 8, 8, 5, 20, 19, 14, 14, 8, 20, 14, 16, 5, 20, 14, 14, 8, 14, 8, 20, 19])] [array([ 8, 5, 19, 20, 16, 20, 16, 16, 20, 14, 5, 8, 14, 20, 20, 14, 14, 16, 8, 5, 20, 16, 16, 20, 19, 16, 19, 14, 20, 20, 8, 5, 16, 20, 20, 16, 8, 14, 20, 5, 8, 20, 8, 14, 19, 14, 14, 16, 14, 19, 14, 16, 20, 8, 14, 5, 20, 16, 16, 14, 5, 5, 8, 16, 14, 20, 14, 5, 8, 16, 8, 8, 20, 14, 19, 19, 16, 16, 8, 5, 8, 5, 19, 20, 20, 8, 19, 5, 5, 14, 19, 5, 16, 16, 16, 8, 20, 8, 20, 16])] [array([ 5, 19, 14, 14, 8, 20, 20, 5, 16, 14, 8, 16, 5, 5, 5, 8, 5, 19, 8, 14, 5, 14, 5, 16, 8, 20, 19, 20, 19, 14, 5, 8, 20, 16, 8, 16, 19, 19, 16, 20, 16, 5, 20, 14, 5, 16, 14, 16, 16, 5, 8, 14, 16, 20, 19, 5, 20, 19, 5, 14, 16, 14, 16, 20, 8, 16, 5, 14, 5, 19, 5, 16, 16, 14, 14, 16, 19, 16, 8, 19, 14, 14, 5, 19, 8, 5, 14, 16, 14, 5, 5, 5, 14, 20, 16, 20, 16, 8, 8, 8])] [array([19, 8, 14, 8, 16, 20, 8, 8, 16, 20, 16, 16, 14, 16, 8, 14, 16, 5, 16, 19, 14, 14, 19, 5, 5, 19, 14, 14, 8, 5, 5, 14, 14, 5, 5, 20, 20, 14, 5, 16, 8, 16, 8, 19, 14, 16, 16, 14, 16, 8, 16, 8, 5, 16, 16, 19, 8, 5, 19, 16, 14, 16, 8, 16, 8, 19, 8, 14, 20, 14, 14, 16, 16, 14, 16, 20, 16, 20, 16, 14, 5, 14, 20, 19, 20, 8, 5, 14, 16, 16, 5, 16, 16, 16, 8, 5, 8, 8, 5, 8])] [array([20, 16, 8, 16, 20, 16, 5, 20, 20, 14, 19, 19, 14, 16, 20, 20, 8, 5, 16, 16, 5, 14, 5, 14, 19, 14, 5, 8, 14, 5, 5, 16, 19, 8, 19, 19, 8, 14, 20, 16, 5, 19, 8, 8, 20, 20, 20, 20, 14, 19, 19, 20, 20, 8, 14, 20, 20, 5, 16, 16, 14, 8, 14, 8, 14, 19, 5, 5, 19, 5, 5, 5, 16, 8, 20, 8, 8, 14, 14, 19, 8, 19, 8, 5, 8, 5, 20, 14, 16, 8, 19, 20, 16, 14, 16, 8, 5, 5, 5, 19])]
Could you please help to figure-out a way to convert these vectors back to natural language?
Thank you.
For more clarification, those vectors are the values returned from this line from dmn_plus.py while running the dmn_test.py:
pred = session.run([self.pred], feed_dict=feed)
hello, do you have any solution for convert predicted vector back to natural language?
They are the index of the vocabulary i.e. ivocab. Simply get the value of that key. ivocab[pred[0]], which should give the answer in natural language.
They are the index of the vocabulary i.e. ivocab. Simply get the value of that key. ivocab[pred[0]], which should give the answer in natural language.
thanks
another question, i have trained model, but i find that the model only support answers which are one word, how to optimize model to support answers which are more than one words? thanks
They are the index of the vocabulary i.e. ivocab. Simply get the value of that key. ivocab[pred[0]], which should give the answer in natural language.
thanks
Did you got the value ?