4

I want to have a many-to-one setting in LSTM using CNTK, i.e Each word in a sentence is a input, and a label per sentence is the output. Hence it is a mapping from many inputs to one output. The example provided in the CNTK Github repository, however, is many-to-many. I am having some trouble understanding the change in input format that has to be done for my application. In the example provided, each word in a sentence has a label associated with it, whereas in my application I want to have a label for a sentence.

Would it be correct to assign the sentence label I have, to all the words in that sentence? Is there is a better alternative approach?

Satarupa Guha
  • 1,267
  • 13
  • 20

1 Answers1

2

This page shows how to take the outputs of an lstm and compute a learnable convex combination of them (also known as attention).

Update: As for the input format you can do it in different ways. If you use the builtin reader you can put the label in the first element of the sequence like in this example. If you feed the data from Python this other thread is relevant.

Community
  • 1
  • 1
  • Nikos, I think that page is a good starting point. Maybe extend it to an end-to-end example, tutorial style, including data input? – Anton Schwaighofer Dec 19 '16 at 18:23
  • Hi Anton, I have added it to my todo list. – Nikos Karampatziakis Dec 19 '16 at 21:51
  • Thanks for answering. But I was not able to connect the two. Can you elaborate a bit how this will be helpful in this scenario? – Satarupa Guha Dec 20 '16 at 09:33
  • 1
    Thanks for updated answer. This data format is what I was looking for. Additionally, I would like to mention this example at https://github.com/Microsoft/CNTK/blob/master/Examples/SequenceClassification/SimpleExample/Python/SequenceClassification.py, which helped me code up my use-case. – Satarupa Guha Dec 22 '16 at 06:56