GRU cells are better than simpleRNN
In this exercise you will re-run the same model as the first chapter of the course to compare the accuracy of the model by simpling changing the SimpleRNN
cell to a GRU
cell.
The model was already trained with 10 epochs, as in the previous model with a SimpleRNN
cell. In order to compare the models, a test set (x_test, y_test)
is already loaded in the environment, as well as the old model SimpleRNN_model
.
Diese Übung ist Teil des Kurses
Recurrent Neural Networks (RNNs) for Language Modeling with Keras
Anleitung zur Übung
- Import the
GRU
cell. - Print the models' summaries.
- Print the accuracy of each model.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Import the modules
from tensorflow.keras.layers import ____, Dense
# Print the old and new model summaries
SimpleRNN_model.____
gru_model.____
# Evaluate the models' performance (ignore the loss value)
_, acc_simpleRNN = SimpleRNN_model.evaluate(X_test, y_test, verbose=0)
_, acc_GRU = gru_model.evaluate(X_test, y_test, verbose=0)
# Print the results
print("SimpleRNN model's accuracy:\t{0}".format(____))
print("GRU model's accuracy:\t{0}".format(____))