How to set window size for LSTM in Matlab?

I was wondering how I can set the window size in an LSTM network, but cant find it under the layer settings.
I'm using the LSTM for time series regression and simulation.
Thanks!

4 Kommentare

Ameer Hamza
Ameer Hamza am 22 Sep. 2020
Are you using the Deep Network Designer app?
No I've got the network topology laid out in code, it's as follows:
For my problem I am using 3 inputs to compute 1 output
numHiddenUnits = 60;
[inputSize, ~] = size(XTrain{1});
layer = [
sequenceInputLayer(inputSize,"Normalization","zscore")
lstmLayer(numHiddenUnits,'OutputMode','sequence')
fullyConnectedLayer(1)
regressionLayer
];
Do I have to process the data in a special way perhaps?
mhd z
mhd z am 6 Sep. 2021
I have the same problem.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ameer Hamza
Ameer Hamza am 22 Sep. 2020

0 Stimmen

You can use NumHiddenUnits option to specify the window size (if by window size, you mean the number of memory units).
lstmLayer(numHiddenUnits,'OutputMode','sequence', 'NumHiddenUnits', 100); % 100 units

5 Kommentare

Thank you for your answer!
I'm afraid that is not quite what I'm looking for. By window size I mean the amount of previous data points taken into the LSTM. My signal is quite dynamic and I would like to adjust how many of these data points are considered. Patrick van der Smagt explains it pretty well in this comment.
Hope this clears things up?
Thank you in advance!
Ameer Hamza
Ameer Hamza am 23 Sep. 2020
Thank you! Perhaps I misunderstood the description but I thought the number of hidden units refers to the amount of cell states and hidden states passed on from cell to cell. Is that the same thing as the window size?
Ameer Hamza
Ameer Hamza am 23 Sep. 2020
Yes, window size defined in the researchgate link is the memory units in the lstm. It is the same as the hidden units in MATLAB.
mhd z
mhd z am 6 Sep. 2021
Bearbeitet: mhd z am 6 Sep. 2021
then what is the matlab's equivalent for number of units in python?
in python : window size = number of hidden units in matlba
in python: number of units = ? in matlab

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Bearbeitet:

am 6 Sep. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by