1

I really appreciate if somebody can give a working code for the following scenario in keras:

1) EACH training/test example is represented as a SET of non related sequences of words. For instance, the example "no.1" may have 3 sequences, but example "no.2" may have 10 sequences.

2) For each example, each of the corresponding sequence goes through a LSTM chain, and then last vector of those LSTMs are "averaged pooled" to obtain a single vector representing all sequences of that example. Then, the averaged vector is fed into a fully connected hidden layer, and then to the softmax.

3) We are using an embedding lookup layer which maps words of those sequences into their corresponding vector (then to LSTM). During training and backpropagation, the embeddings are also fine-tuned.

I know I can put a fixed number of LSTM chains, and then do average pooling, but since the number of sequences for each example is dynamic, I am searching for a real solution.

Cheers, Farrokh.

Farrokh M
  • 11
  • 2

0 Answers0