Now that we have some baseline models in place, let's proceed by constructing what this chapter is all about: an LSTM. We will first start with a plain one-layer LSTM with no dropout strategy, equipping it with 32 neurons as follows:
def simple_lstm(): model = Sequential() model.add(LSTM(32, input_shape=(1, 7))) model.add(Dense(1, activation='linear')) model.compile(loss='mae', optimizer='adam') return model
We connect the LSTM layer to our dense regressor layer, and continue to use the same loss and optimizer and loss functions.