0

I am using a LSTM based neural architecture for a forecasting problem, following lines of codes will give an idea:

model = Sequential()
model.add(InputLayer((X_train.shape[-2], X_train.shape[-1])))
model.add(LSTM(32, return_sequences=True))
model.add(LSTM(64))
model.add(Dense(8, 'relu'))
model.add(Dense(1, 'linear'))

model.compile(optimizer="rmsprop", loss="mse", metrics=["mae"])
history = model.fit(x=X_train,y=y_train,
                    epochs=1500,
                    validation_data=(X_val, y_val),
                    callbacks=callbacks)

I got the following plot for training and validation error: enter image description here

The optimum solution occurs at epoch=1200, but since I need to run this forecasting model in the loop, again and again, I want to reach this point in an automated/programmatic manner. I tried early stopping, but since the train/validation error is initially a little fluctuating (not very visible in the plot) it stopped after a few epochs.

Any suggestions?

jsejcksn
  • 27,667
  • 4
  • 38
  • 62

0 Answers0