# LSTM input and output for sentiment analysis

I'm studying this LSTM network: https://www.kaggle.com/paoloripamonti/twitter-sentiment-analysis

model = Sequential()

model.summary()


I understand the input part of the embedding layer. Each word get's a unique vector that represents the meaning of the word.

The drop out will deactivate neurons. So the input for the LSTM model is the vocabulary where each token is represented by a vector.

I understand the workflow in an LSTM model. But what exactly does it do with the input? Give it a score by learning? And what is the output of the lstm?

Here is the summary:

• Is the question here "How does an LSTM work?" or is the question specific to this use case? – Andy M May 1 '19 at 13:19
• Specific for this case. I know how a LSTM works (the gates, nodes etc). But I wonder what happens with my dataset and what the output is of the LSTM. Is it a 2D vector for each word? – sg_sg94 May 1 '19 at 13:38
• so the input are vectors that represents tokens. The output is a vector with represents the sentiment score? Or not? – sg_sg94 May 1 '19 at 13:45

• If you look for x_train in the code, you'll see where the x variable is created as a sequence of indicies using keras tokenizer.texts_to_sequences and pad_sequences. The output will be for every sequence of tokens (tweets), not individual tokens. – Andy M May 1 '19 at 16:44