Preparing data for multi-step time series forecast using LSTM

조회 수: 6 (최근 30일)
Aniroodh Kumaraswamy
Aniroodh Kumaraswamy 2022년 2월 21일
답변: Shivam Lahoti 2023년 12월 31일
Hello,
I am trying to predict a multi-step future estimate of a certian parameter using previously logged time-series data (with just one feature)
I have two major questions relating to this:
Question 1) Let us assume I want to use the previous 500 values to get an estimate for the next 200 values. How do I prepare the input data for training the LSTM for such a case. If i enter training data of the following type, it gives me an error saying 'Sequence responses must have the same sequence length as the corresponding predictors.'
How do I solve this problem?
Question 2) Is there any other way apart from looping the predictAndUpdateState 200 times to get the predicted output for an arbitrary test data after training the network? And....is there any specific parameter to be set in the TrainingOptions for this?
for i = 2:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1),'ExecutionEnvironment','cpu');
end
I would really appreciate a solution to this,
Aniroodh

답변 (1개)

Shivam Lahoti
Shivam Lahoti 2023년 12월 31일
Hi Aniroodh,
I can understand that you want to prepare data to predict a multi-step future estimate of a certain parameter using previously logged time-series data.
For Question 1: You can try a different approach where for each training example, you select 500 consecutive values as the input and the subsequent 200 values as the output. Slide this window through your time series to create multiple such pairs. By preparing data like this you can train an LSTM network for multi-step time series forecasting.
Please refer to the prepare data section of the following documentation for more details.
Regarding Question 2: The ability to predict multiple steps at once without looping depends on how you've structured and trained your network. If your network is trained for one-step predictions, you'll need to use a loop or retrain your network to predict multiple steps at once.
I hope this was helpful.
Regards,
Shivam Lahoti.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by