I'm working on time series prediction with Keras.
I have 10 timesteps in my input data which is of the shape (2688, 10, 1) i.e train_x.shape and train_y.shape is (2688, 10, 1).
I am getting the following error while I try to feed it into the model.
ValueError: Error when checking target: expected activation_1 to have 2 dimensions, but got array with shape (2688, 10, 1)
The input shape that I am giving to the first lstm layer: input_shape=(1, time_steps)
**
Am i reshaping train_y properly?
**
time_steps=10
train_x = np.reshape(train_x, (train_x.shape[0], train_x.shape[1], 1))
train_y = np.reshape(train_y, (train_y.shape[0], train_y.shape[1], 1))
# lstm model
model = Sequential()
model.add(LSTM(128, input_shape=(time_steps, 1), return_sequences=True))
model.add(LSTM(64))
model.add(Dense(1))
model.add(Activation('linear'))
model.compile(loss='mse', optimizer='adam')
history = model.fit(train_x, train_y, epochs=10, validation_data=(test_x,
test_y), batch_size=64, verbose=1)
input_shape=(time_steps, 1)