I am creating a LSTM model in Keras with Python and I have the next context:
I have a regression problem, and I want a LSTM model of X different layers that inputs a sequence of 40 elements and outputs the next Y values. Those Y values should be dynamic. This is: maybe I want to predict the next 10 elements for a sequence of 40 elements in one case, but in other case I want to predict the next 100 values.
My question is: is it possible?
I have the next code:
model = Sequential()
model.add(LSTM(200, activation='relu', input_shape=(trainx.shape[1], trainx.shape[2])))
model.add(RepeatVector(outputs))
model.add(LSTM(200, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(100, activation='relu')))
model.add(TimeDistributed(Dense(1)))
model.compile(loss='mse', optimizer='adam')
# fit network
history = model.fit(trainx, trainy, epochs=100, batch_size=300, verbose=1)
# make predictions
trainPredict = model.predict(trainx)