How to prepare time series data for LSTM training?

20 vues (au cours des 30 derniers jours)
Marco Pizzoli
Marco Pizzoli le 12 Oct 2023
Commenté : Marco Pizzoli le 16 Oct 2023
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

Réponse acceptée

Neha
Neha le 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!
  1 commentaire
Marco Pizzoli
Marco Pizzoli le 16 Oct 2023
Thank you very much for the help Neha!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by