My x_train
shape is (798,3) and y_train
input shape is (798, 1). I am creating a RNN like this
def create_rnn_model():
model = Sequential()
model.add(SimpleRNN(20,return_sequences=False,stateful=stateful,activation='relu',batch_input_shape=(1,3,1)))
model.add(Activation('relu'))
adam = optimizers.Adam(lr=0.001)
model.compile(loss='mean_squared_error', optimizer=adam, metrics=[root_mean_squared_error])
return model
But this returns the error
ValueError: Error when checking input: expected simple_rnn_1_input to have 3 dimensions, but got array with shape (798, 3)
My batch size =1 and my timestep is 3 and dat_dim=1
.Then where am I doing it wrong?
Any help is appreciated.
EDIT
I changed my x_train to shape (798,3,1) and y_train shape to (798,) and ran the model but it threw an error
ValueError: Error when checking target: expected activation_1 to have shape (20,) but got array with shape (1,)
But I can run the model with 1 unit. How do I specify the model to run with 20 units instead of one.