August 2018
Intermediate to advanced
378 pages
9h 9m
English
So far, the best approaches we have seen are from the 1D convolutional neural network model which got 95.73%, and the gated recurrent units model which got 95.90% accuracy. The following code combines them! The code for our bidirectional with 1D convolutional neural network model is in Chapter7/classify_keras8.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_spatial_dropout_1d(rate ...