An advantage of using TensorFlow and Keras is that they make it easy to create models. Just like LSTM, creating a GRU model is only a matter of adding the GRU layer instead of LSTM or SimpleRNN layer, as follows:
model.add(GRU(units=4, input_shape=(X_train.shape[1], X_train.shape[2])))
The model structure is as follows:
Layer (type) Output Shape Param # ================================================================= gru_1 (GRU) (None, 4) 72 _________________________________________________________________ dense_1 (Dense) (None, 1) 5 ================================================================= Total params: 77 Trainable params: 77 Non-trainable params: 0
The complete code for the GRU model is provided in notebook ch-07b_RNN_TimeSeries_Keras.
As expected...