The simplest form of sentiment analysis task deals with categorizing whether a piece of text represents a positive or negative opinion. This is often referred to as a polar or binary sentiment classification task, where 0 refers to a negative sentiment and 1 refers to a positive sentiment. We can, of course, have more complex sentiment models (perhaps using the big-five personality metrics we saw in Chapter 1, Overview of Neural Networks), but for the time being, we will concentrate on this simple yet conceptually loaded binary example. The example in question refers to classifying movie reviews from the Internet Movie Database or IMDB.
The IMDB dataset consists of 50,000 binary reviews, which are evenly split into positive and negative opinions. Each review consists of a list of integers, where each integer represents a word in that review....