Appropriate data structure for using predictand update state for LSTM
2 views (last 30 days)
Show older comments
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.
Answers (1)
Aditya Patil
on 22 Dec 2020
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.
See Also
Categories
Find more on Develop Apps Using App Designer 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!