Clear Filters
Clear Filters

LSTM - multiple time series with multiple features

11 views (last 30 days)
LM_BU
LM_BU on 26 Feb 2021
Answered: Krishna on 24 Apr 2024
Hi,
My problem is as follows. I have a piece of software from which I collect data at a specified interval y, thereby creating sequences every x seconds. Thus, every x seconds, a sequence of length x/y is created using m features per sequence. The data are collected from several time points since the software's initialization. It could be from the first second, the fifth minute, the 23rd minute, etc.
I want to train an LSTM network using this kind of data (multiple sequences), typically done so via a cell array. Then, given an unseen sequence of size n x m that has come from an arbitrary time point during the software's activity, where 1 ≤ n ≤ x/y, I wish to forecast the data at the next time step, i.e. of size 1 x m. As a note, the time relative to the software's inception is a feature of said data m.
To my understanding, the closest way I have found in the documentation is the sequence-to-sequence regression. However, I am not sure how to change the layers used there and how to structure the data such that they conform to the desired output and the multivariate input (features and multiple time-series sequences). Can I even do this with the current tools?
Any help will be greatly appreciated!

Answers (1)

Krishna
Krishna on 24 Apr 2024
Hello,
I understand that you're gathering data at every "y" time interval and creating sequences at every "x" time interval with a length of x/y. You're interested in using LSTM modeling to predict future data points. Essentially, you wish to forecast the next value for any given sequence, indicating an attempt at sequence-to-one time series modeling. This type of approach is indeed possible in MATLAB. You simply need to adjust the lstmLayer setting from 'sequence' to 'last' to ensure only one output is generated.
Additionally, you should structure the training dataset in a way that allows you to use sequence to one modelling, for example, 10 values to predict the 11th value, like this.
Define your layers like this,
layers = [ ...
sequenceInputLayer(numChannels, Normalization="zscore")
lstmLayer(numHiddenUnits, OutputMode="last")
fullyConnectedLayer(numResponses)];
Please go through the following example to learn more,
Also, you go through the following documentation to learn more about LSTM in MATLAB,
Hope this helps.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!