Preparing data for multi-step time series forecast using LSTM
7 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File 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!