I'm playing around with machine learning and trying to follow along with some examples but am stuck trying to get my data into a Keras LSTM layer.
I have some stock ticker data in a Pandas DataFrame which is resampled at 15 minute intervals with ohlc and a load of other metrics for each row.
My code is below. df is my DataFrame:
x = df.iloc[:, :-1].values
y = df.iloc[:, -1:].values
dimof_input = x.shape[1]
dimof_output = len(set(y.flat))
model = Sequential()
model.add(LSTM(4, input_dim=dimof_input, return_sequences=True))
model.compile(loss='mse', optimizer='rmsprop')
model.fit(x, y, nb_epoch=1, batch_size=1, verbose=2)
When I try and fit I get:
Error when checking input: expected lstm_16_input to have 3 dimensions,
but got array with shape (33, 100)
I've copied this from examples elsewhere. I can't quite see how to get the correct shape of data into this model. Can anyone help?
Thanks loads.