MATLAB Answers

How to use trainNetwork with varying lengths of inputs and outputs?

3 views (last 30 days)
Renita Raidoo
Renita Raidoo on 19 Jun 2020
Answered: Divya Gaddipati on 25 Jun 2020
Hi all. I have a problem using trainNetwork for a seq-to-seq regression problem. The error it gives is "Sequence responses must have the same sequence length as the corresponding predictors". I have used a sliding window to take 5 previous timesteps (with multiple features concatenated into a cell) and predict a single feature 2 timesteps into the future. It works when I try to predict 5 timesteps into the future but won't work if the Y_Train cell has comma separated row vectors with any other number of entries within the cell. Is there some way to use the LSTM layers to do this type of forecasting? I hope the pictures of the data helps .

  0 Comments

Sign in to comment.

Answers (1)

Divya Gaddipati
Divya Gaddipati on 25 Jun 2020
From the error, I'm guessing the size of the output from the last layer of your network is not same as the size of YTrain, which is causing the error. Modify the last layer to output responses of size(Ytrain).
For more information on defining networks for sequence-to-sequence regression type problems, you can refer to the following link:

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!