deep learning for text and sequences nowlet' use such model on the imdb movie-review-classification problem firstpreprocess the data listing preparing he imdb dat from keras datasets import imdb from keras preprocessing import sequence max_features maxlen batch_size number of words to consider as features cuts off texts after this many words (among the max_features most common wordsprint('loading data '(input_trainy_train)(input_testy_testimdb load_datanum_words=max_featuresprint(len(input_train)'train sequences'print(len(input_test)'test sequences'print('pad sequences (samples time)'input_train sequence pad_sequences(input_trainmaxlen=maxleninput_test sequence pad_sequences(input_testmaxlen=maxlenprint('input_train shape:'input_train shapeprint('input_test shape:'input_test shapelet' train simple recurrent network using an embedding layer and simplernn layer listing training he model with embedding and simplernn layers from keras layers import dense model sequential(model add(embedding(max_features )model add(simplernn( )model add(dense( activation='sigmoid')model compile(optimizer='rmsprop'loss='binary_crossentropy'metrics=['acc']history model fit(input_trainy_trainepochs= batch_size= validation_split= nowlet' display the training and validation loss and accuracy (see figures and listing plot ing result import matplotlib pyplot as plt acc history history['acc'val_acc history history['val_acc'loss history history['loss'val_loss history history['val_loss'epochs range( len(acc plt plot(epochsacc'bo'label='training acc'plt plot(epochsval_acc' 'label='validation acc'licensed to