LSTM sequence-to-one regression
3 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Asvin Kumar
on 11 May 2021
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.
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!