We will continue to use IMDB movie review data that we used in the previous chapter on recurrent neural networks. This data is already available in a format where we can use it for developing deep network models with minimum need for data processing.
Let's take a look at the following code:
# IMDB data
library(keras)
imdb <- dataset_imdb(num_words = 500)
c(c(train_x, train_y), c(test_x, test_y)) %<-% imdb
train_x <- pad_sequences(train_x, maxlen = 200)
test_x <- pad_sequences(test_x, maxlen = 200)
The sequence of integers capturing train and test data is stored in train_x and test_x respectively. Similarly, train_y and test_y store labels capturing information about whether movie reviews are positive or negative. We have specified the number of most frequent words to be 500. For padding, we are using 200 as the maximum length...