Using LSTM with a featureinputplayer

3 Ansichten (letzte 30 Tage)
Haoming
Haoming am 31 Okt. 2024
Kommentiert: Haoming am 11 Nov. 2024
While reading the lstm and its relative docs, i noticed that a LSTMLayer always connected after a SequenceInputLayer.
When i using lstm with a featureinputlayer and my input data is a 2-D matrix ( shape = (data_length, num_features)), I found that the network can still run. So my question is : will matlab treats it as ONE sequence with ${data_length} tokens. Or $[{data_length} sequences (sequence_length = 1)?
Thanks in advanced for your help!
  1 Kommentar
Haoming
Haoming am 31 Okt. 2024
In addition, how can i apply tbptt into lstm using matlab

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Gayathri
Gayathri am 4 Nov. 2024
When you use an LSTM layer in MATLAB with a “featureInputLayer” and your input data is a 2-D matrix with shape (data_length, num_features), MATLAB treats the input as one sequence with data_length tokens. For more understanding on which layer to use with LSTMs consider the below points.
  • · LSTMs are used to handle long term dependencies. So, LSTM would be used when you have data with some sort of “time ordering”.
  • · “sequenceInputLayer” is typically used when your input data is inherently sequential, such as time series data or sentences in NLP tasks. It expects data in a 3-D format: (sequence_length, num_features, num_sequences).
  • · For time series data, you can't swap the order of timesteps - this changes the meaning of your data. This is the reason why we use “sequenceInputLayer” before “lstmLayer”.
“featureInputLayer” is generally used for non-sequential data. However, when used with an LSTM, MATLAB can treat the data as a single sequence by default.
For more information on the “sequenceInputLayer” and “featureInputLayer” please refer to the below mentioned links.
Hope you find this information helpful.

Weitere Antworten (0)

Kategorien

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

Tags

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by