I wanted to know if there's a way to select an optimum number of epochs and neurons to forecast a certain time series using LSTM, the motive being automation of the forecasting problem, i.e. the algorithm selects the right number of epochs and neurons on its own by checking the data.

  • $\begingroup$ Provide more information! We have no idea what your dataset is like, we have no idea how big your network is initially. Secondly, selecting the right no. of epochs is something completely different than the right no. of neurons. And basically: every problem requires a different amount, so mostly it has to be found out by trial and error. Some related stuff. And this. Google = power $\endgroup$ – Thomas W Jun 22 '17 at 15:00

The optimum parametrization depends on the problem (there is not a rule that can do what you want), but there are some techniques that can help you, see the link below. http://machinelearningmastery.com/tune-lstm-hyperparameters-keras-time-series-forecasting/

Basically what the upper link does is:

  1. First calculate the RMSE of train and test data for each epoch with different number of maximum epochs. This prevents you to overfit and gives an aproximated range of epochs to start with.
  2. Afterwards you can repeat the method but maintaining the epochs constant (previously selected) and testing with different neuron number.

It's important that the RMSE test curve must not be convex as it denotes overfitting. Whith this method you can tune this paramaters obtaining a good trade off between accuracy and generalization.

  • $\begingroup$ Do you think you could expand your answer to include a brief summary of the contents of the link? We're wary of link-only answers, due to linkrot - if this link goes dead, a lot of the value of this answer will have gone. $\endgroup$ – Silverfish Jul 28 '17 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.