In Implementing RNN for sentiment classification recipe, we implemented sentiment classification using RNN. In this recipe, we will look at implementing it using LSTM.
Implementing LSTM for sentiment classification
How to do it...
The steps we'll adopt are as follows (the code file is available as RNN_and_LSTM_sentiment_classification.ipynb in GitHub):
- Define the model. The only change from the code we saw in Implementing RNN for sentiment classification recipe will be the change from simpleRNN to LSTM in the model architecture part (we will be reusing the code from step 1 to step 6 in the Implementing RNN for sentiment classification recipe):
embedding_vecor_length=32
max_review_length=26
model = Sequential()
model.add...