Using LSTM with a featureinputplayer
30 次查看(过去 30 天)
显示 更早的评论
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!
采纳的回答
Gayathri
2024-11-4,6:20
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!