August 2018
Intermediate to advanced
378 pages
9h 9m
English
We saw in Figure 7.1 that RNNs (as well as LSTMs and GRUs) are useful because they can pass information forwards. But in NLP tasks, it is also useful to look backwards. For example, the following two strings have the same meaning:
Bidirectional LSTMs can pass information backwards as well as forwards. The code for our bidirectional LSTM model is in Chapter7/classify_keras6.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 ...
Read now
Unlock full access