How to implement LSTM Time-series prediction using multi-features?

10 ビュー (過去 30 日間)
Mohamed Nedal
Mohamed Nedal 2020 年 1 月 15 日
コメント済み: Asli 2021 年 5 月 21 日
Hello everyone,
I have the attached code and the attached data file here. I want to modify that code to proceed time-series prediction for 1 output using 5 inputs.
When I the training finishes I get the following error:
The prediction sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 4.
Error in multi_lstmOMNI_noStand (line 110)
[net,YPred] = predictAndUpdateState(net,YTrain);
Can you please tell me how to fix it?
I appreciate your help.
  5 件のコメント
Mohamed Nedal
Mohamed Nedal 2020 年 5 月 9 日
Great!, Thanks a lot
If you were going to forecast the future data (Y) that you don't have, and there are no data for input features yet (X; because they are in the future), What would you do in this case?
Mohamed Nedal
Mohamed Nedal 2020 年 7 月 3 日
Hi @Marcelo,
I tried to add a few lines of code to predict new future values of the target output, here's what I added:
%% Forecast the Future
net = resetState(net);
Yforecast = [];
numTimeStepsTest = numel(XTest) + 500; % to forecast new 500 steps in the future
for i = 1:numTimeStepsTest
[net, Yforecast(:,i)] = predictAndUpdateState(net, XTest(:,i), 'ExecutionEnvironment','cpu');
end
but I got this error:
Conversion to double from cell is not possible.
Error in LSTM_multi_motores (line 82)
[net, Yforecast(:,i)] = predictAndUpdateState(net, XTest(:,i),
'ExecutionEnvironment','cpu');
Can you please tell me how to fix this part?

サインインしてコメントする。

採用された回答

Marcelo Olmedo
Marcelo Olmedo 2020 年 5 月 6 日
Hello people; I found the problem; the key is in the correct loading of data as the published documents say. I attach my code and used tables so you don't have problems to run it; I upload data from excel to train and test. I do not use standardized data. The model fits quite well. Cheers
  4 件のコメント
Song Decn
Song Decn 2021 年 4 月 27 日
Thnks!!
Asli
Asli 2021 年 5 月 21 日
Hi Marcelo, i am really new in this topic and i am trying to predict time series of Y depending on two external variables (X1 and X2). I have two questions. (i) Why don’t you use the “predictAndUpdateState” and why do you use the “predict” statement? Is it used for time series prediction? (ii) Why are the previous y values not input into this function? Only x values are input.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by