Time Series Forecasting Using Deep Learning - More Input Data

2 visualizzazioni (ultimi 30 giorni)
The example describes how you can use observed values instead of predictions to improve error in time series. But this is a time series that doesn't take any external input.
How would one use this same process to predict monthly cases if we had access to additional information, like average temperatures for a given month as well as doctor visits?
In this case, let's assume
Xtrain is 500-timesteps of 3 data points
Ytrain is 500 timesteps of cases
Xtest is 100 timesteps of 3 data points
Ytest is 100 timesteps of cases
How would this code change:
%If you have access to the actual values of time steps between predictions, then you can update the network state with the observed values instead of the predicted values.
%First, initialize the network state. To make predictions on a new sequence, reset the network state using resetState. Resetting the network state prevents previous predictions from affecting the predictions on the new data. Reset the network state, and then initialize the network state by predicting on the training data.
net = resetState(net);
net = predictAndUpdateState(net,XTrain);
%Predict on each time step. For each prediction, predict the next time step using the observed value of the previous time step. Set the 'ExecutionEnvironment' option of predictAndUpdateState to 'cpu'.
YPred = [];
numTimeStepsTest = numel(XTest);
for i = 1:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,XTest(:,i),'ExecutionEnvironment','cpu');
end
Thanks for clearing this up!
-R

Risposte (0)

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by