LSTM sequence-to-one regression

12 次查看(过去 30 天)
I'm trying to the use sequence-to-one regression framework using OutputMode = 'last' with no success. I have a time series dataset with 10 features to predict 3 targets, with a total of 30 sequence/target rows. My training data is formatted such that XTrain is a {30x1} cell, where each cell is [10 x L] and L represents the varying sequence length. YTrain is [30 x 3], representing the three targets for each sequence.
The code runs fine, but the LSTM predicts YPred = [30 x 3] and each column has the same value for all 30 sequences! Is there some setting I'm missing, or can anyone point me to an example where this structure was successfully used in MATLAB?

回答(1 个)

Asvin Kumar
Asvin Kumar 2021-5-11
If you could share the code that you've written so far, the community will be able to help you better.
If I still had to guess, I would say this is because YTrain is not a cell array of size 30x1 similar to XTrain. Each cell of YTrain would then have an array of size 3x1.
Also, ensure that the 'OutputMode' property is set to 'last'. You can set the 'NumHiddenUnits' to 3 or you can set it to a larger size as required and then follow up the lstmLayer with a fullyConnectedLayer whose outputSize is 3 similar to this example on Japanese vowel classification. The output size of the lstmLayer will be 'NumHiddenUnits' as mentioned here. This will be the input size to the fullyConnectedLayer.

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by