Sentiment analysis with Keras embedding layers and LSTMs

The first case study in this chapter will demonstrate sentiment analysis. In this example, we will get to apply most of the things we have learned in the chapter.

We will be using a dataset built into Keras from the Internet Movie DataBase (IMDB). This dataset contains 25,000 movies reviews, each labeled by sentiment. Positive reviews are labeled 1 and negative reviews are labeled 0. Every word in this dataset has been replaced with an integer that identifies it. Each review has been encoded as a sequence of word indexes.

Our goal will be to classify movie reviews as either a positive or negative review using only the text in that review.

Get Deep Learning Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.