Appropriate data structure for using predictand update state for LSTM

2 次查看(过去 30 天)
Hello
I am trying to fit a LSTM network for forecast time series data using using the example on this help-page i.e with the trainNetwork command :
My problem is i am using a multi input training data instead of a single column data as in example.and i am getting the below error while trying to use the predict and update command:
The prediction sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 5.
net = predictAndUpdateState(net,XTrain);
[net,YPred] = predictAndUpdateState(net,YTrain(end));
numTimeStepsTest = numel(XTest);
for i = 2:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1),'ExecutionEnvironment','cpu');
end
my Xtrain is 5*576 double array
Ytrain is 1*576 duble array
How can i convert data from array format to use for predictandupdate command and to use in the loop.
Thanks for advance.
Please let me know if any additional inofrmation is required.

回答(1 个)

Aditya Patil
Aditya Patil 2020-12-22
As per my understanding, the sizes of your Xtrain and Ytrain datasets are not matching.
The method to fix this issue will depend on the how the data is organized. If it's a single sequence of data and Xtrain has been reshaped to be of size 5 * 576, then you should be able to reshape Ytrain in similar manner.
However, if these are unrelated datasets, then it will depend on the data itself. If Xtrain has 5 features, and Ytrain has only one, you cannot use Ytrain with the same model.
  1 个评论
NN
NN 2020-12-22
Thank you very much for the response.I request you to please explain more about the line "If it's a single sequence of data and Xtrain has been reshaped to be of size 5 * 576, then you should be able to reshape Ytrain in similar manner".
How can i reshape Ytrain?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by