Using LSTM with a featureinputplayer

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 件のコメント

Haoming
Haoming 2024 年 10 月 31 日
In addition, how can i apply tbptt into lstm using matlab

サインインしてコメントする。

 採用された回答

Gayathri
Gayathri 2024 年 11 月 4 日

0 投票

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.

1 件のコメント

Haoming
Haoming 2024 年 11 月 11 日
Thanks! It helps me a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

リリース

R2024b

タグ

質問済み:

2024 年 10 月 31 日

コメント済み:

2024 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by