August 2018
Intermediate to advanced
378 pages
9h 9m
English
Bidirectional models are good at picking up information from future states that can affect the current state. Stacked bidirectional models allow us to stack multiple LSTM/GRU layers in a similar manner to how we stack multiple convolutional layers in computer vision tasks. The code for our bidirectional LSTM model is in Chapter7/classify_keras7.R. The parameters for the model are max length=150, the size of the embedding layer=32, and the model was trained for 10 epochs:
word_index <- dataset_reuters_word_index()max_features <- length(word_index)maxlen <- 250skip_top = 0..................model <- keras_model_sequential() %>% layer_embedding(input_dim = max_features, output_dim = 32,input_length = maxlen) %>% layer_dropout(rate ...