Time series forecasting using LSTM with multiple time series of the same type

Hi all,
I'm following this Time Series Forecasting example using LSTM networks.
I'm wondering if it is possible to train the network for more than one similar time histories.
I mean that if I have a lot of similar curves could I train the network using the information from all of them?
Using one single trend to train a model seem to be pretty restrictive.

 Accepted Answer

Yes you can retrain the already trained network on new data (provided your data and prediction are of same data type, the length of sequences must be same while giving input to network). You can retrain the network parameters on multiple time series data. However depending on application it may or may not give you good results. For example if correlation between two time series data is high you will get a prediction encompassing properties of both time series it may be better, however if there is no correlation between two time series data your results will suffer.

6 Comments

Thank you for the answer. If I have a "net" object, how can I retrain it? I mean if I use the "trainNetwork" function I'm overwriting the net I've obtained.
You will retrain as you trained your first network except for the part where you initialized layers and weights. In crude sense you can say its overwriting (finding parameters that best fit the combined model of your multiple time series data).
So the workflow is:
  • Definition of layers and options
  • Definition of training set1
  • net = trainNetwork(XTrain1,YTrain1,layers,options);
  • Definition of training set2
  • net = trainNetwork(XTrain2,YTrain2,layers,options);
And I'm not loosing the information learned in the first training?
Yes when training with multiple series you will loose information from first net because it will try to best fit the two/three (how many you give) series you are trying to fit. In crude form you can say it will be some form of avergae of those series. Thats why its very important the multiple time series have high correlation therefore your information loss will be minimum. There is no point in training multiple series with no correlation, that model will not fit anything properly. Yes your workflow is correct.
retrain individually is not a good idea. I'm wondering why Matlab cannot implement such a simple extension to train multiple time series data directly. The difference is when calculating the MSE, you'll consider all time series data instead of only one time series data. I think this limitation is pretty bad for Matlab neural network toolbox.

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!