3 is a big file, but I would like to reset the state after mini_batch_size of 50.
n_epoch=10000
n_batch=50
# create and fit the LSTM network
model = Sequential()
model.add(LSTM(3,batch_input_shape =(n_batch,trainX.shape[1], trainX.shape[2]),stateful=True))
model.add(Dense(1))
model.add(Activation("linear"))
model.compile(loss="mse", optimizer="adam")
model.summary()
#fitting model
for i in range(n_epoch):
history=model.fit(trainX, trainY, epochs=1, batch_size=n_batch,verbose=2, shuffle=False)
model.reset_states()
I am getting the error:
value error: In a stateful network, you should only pass inputs with a number of samples that can be divided by the batch size. Found: 63648 samples<
How can I train a LSTM in mini_batch size of 50 (a number which is not divisible by trainX)?
stateful=False. – n1k31t4 Jun 30 '18 at 16:50