Clear Filters
Clear Filters

How to prepare time series data for LSTM training?

33 views (last 30 days)
Hello everyone,
I want to train an LSTM network model on the basis of time series (with Deep Learning Toolbox©). The process to be modeled is single-input-single-output.
I have available the time series of input u(t) and the time series of output y(t).
My doubt is as follows, before I start training with the trainNetwork function, should I preprocess the data by shifting as follows
input = u(1:end-1);
output = y(2:end);
or can I provide the u(t) and y(t) series directly as follows?
input = u(1:end);
output = y(1:end);
Thank you very much in advance for the support.
Marco

Accepted Answer

Neha
Neha on 16 Oct 2023
Hi Marco,
I understand that you want to know how to prepare time series data for an LSTM network given two different time series for input and output. Generally, the shifting is done within a single array "X" where it's assumed that the output at time "t" is dependent on the input at time "t-1". This is a common setup for autoregressive models where you're predicting future values of a sequence based on its past values. The same has been demonstrated here:
Since you have two different time series and assuming that your output at time "t" is directly correlated with the input at the same time "t", you can use the sequences as they are (the second approach). But if you're trying to predict "y(t+1)" based on "u(t)", you would shift your "y" sequence (the first approach).
Hope this helps!

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!