GauravBh1010tt / DeepLearn

Implementation of research papers on Deep Learning+ NLP+ CV in Python using Keras, Tensorflow and Scikit Learn.
MIT License
1.82k stars 353 forks source link

neural tensor network data #11

Open shuxiaobo opened 6 years ago

shuxiaobo commented 6 years ago

Hi , Thank for your code, I learned a lot from them, especially NTN, now I wana do some new model and eval on new data set, but I don't know how to generate the embedding mat in the experience of neural tensor network, could you please tell me how to do it? thanks

GauravBh1010tt commented 6 years ago

@shuxiaobo - You may find Convolution neural tensor network as useful. Here, we are passing question-answer vector embeddings to the NTN model that can compute a similarity score for us. Also, try out DL-text for quick preprocessing and preparing of embeddings.

shuxiaobo commented 6 years ago

I still not find the detail implement, could you tell me what's means of the value in mat_contents described below? 'Word', 'We', and the 'tree', thanks.

\input: Generic function to load embeddings from a .mat file def load_embeds(file_path): mat_contents = sio.loadmat(file_path) words = mat_contents['words'] we = mat_contents['We'] tree = mat_contents['tree'] word_vecs = [[we[j][i] for j in range(embedding_size)] for i in range(len(words[0]))] entity_words = [map(int, tree[i][0][0][0][0][0]) for i in range(len(tree))] return (word_vecs, entity_words)