Appropriate data structure for using predictand update state for LSTM

2 ビュー (過去 30 日間)
NN
NN 2020 年 12 月 18 日
コメント済み: NN 2020 年 12 月 22 日
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 Center および File ExchangeDevelop 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