I have a an MxN matrix of time-series data that includes X, Y, and Z features such that X, Y, and Z are correlated. Instead of simply fitting a line to these features independently, I would like the LSTM to model the correlations between these features, as well.
For example, if X is low then Y will be high. Thus, when I am testing, not only should the model "predict" the next value of Y based on the previous values of Y but also if the value of X is low then the value of Y should be high.
How do I allow my LSTM to model not only the time-series aspect of the data but also the correlations between the features of the data?
Below is my current Keras LSTM model.
Thank you!
model = Sequential()
model.add(LSTM(4, batch_input_shape=(batch_size, look_back,
dataset.shape[1]), stateful=True, return_sequences=True))
model.add(LSTM(4, batch_input_shape=(batch_size, look_back,
dataset.shape[1]), stateful=True))
model.add(Dense(dataset.shape[1]))
model.compile(loss='mean_squared_error', optimizer='adam')
for i in range(10):
model.fit(trainX, trainY, epochs=1, batch_size=batch_size,
verbose=2, shuffle=False)
model.reset_states()
The link below shows my current output from my LSTM model. The solid spiked lines are the true data. The first curves are the training predictions, and the second curves are the test predictions. Instead of simply fitting a line to the individual features, I would like to figure out how the model can find correlations between the features in the hopes of creating more accurate test predictions.