I am training neural net for time series predictions. My data looks like this:
train_generator = TimeseriesGenerator(X, y, length=7*24, stride=24, batch_size=32)
print(X.shape, y.shape)
>>>((126336, 3), (126336, 24))
The training works fine on this architecture:
model = Sequential()
model.add(LSTM(16, return_sequences=True, input_shape=(7*24, X.shape[1])))
model.add(Dropout(0.3))
model.add(LSTM(32, return_sequences=True, input_shape=(7*24, X.shape[1])))
model.add(Dropout(0.3))
model.add(LSTM(64))
model.add(Dense(24))
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['mse'])
model.fit(train_generator, validation_data=val_generator, epochs=15, verbose=1)
However, I tried to train on this simpler architecture:
model = Sequential()
model.add(LSTM(32, return_sequences=True, input_shape=(7*24, X.shape[1])))
model.add(Dense(24))
In the second case I get an error message:
InvalidArgumentError: Incompatible shapes: [32,168,24] vs. [32,24]
What am I doing wrong? How can I make training possible on the second architecture? And is there a general rule I have to consider so that there are no shape incompatibilities? Tnx