How to work with multiple inputs for LSTM in Keras?
Change
a = dataset[i:(i + look_back), 0]
To
a = dataset[i:(i + look_back), :]
If you want the 3 features in your training data.
Then use
model.add(LSTM(4, input_shape=(look_back,3)))
To specify that you have look_back
time steps in your sequence, each with 3 features.
It should run
EDIT :
Indeed, sklearn.preprocessing.MinMaxScaler()
's function : inverse_transform()
takes an input which has the same shape as the object you fitted. So you need to do something like this :
# Get something which has as many features as dataset
trainPredict_extended = np.zeros((len(trainPredict),3))
# Put the predictions there
trainPredict_extended[:,2] = trainPredict
# Inverse transform it and select the 3rd column.
trainPredict = scaler.inverse_transform(trainPredict_extended)[:,2]
I guess you will have other issues like this below in your code but nothing that you can't fix :) the ML part is fixed and you know where the error comes from. Just check the shapes of your objects and try to make them match.