I have a data set that I split into:
- training: predictors X_TR (1028records in 14 variables) and Y_TR (1028records single variable),
- application: X_APP (115 x 14), Y_APP (115×1),
where each record is a time step t.
My goal is to construct a NN model that predicts Y(t+1) using whatever historical information up to t, that is Y(T+1) = f(X(t),X(t-1),…,Y(0),X(t),X(t-1),…,Y(0)). Note that it is reasonable to consider iformation no older than 10 time steps. According to mathworks.com/help/nnet/gs/neural-network-time-series-prediction-and-modeling.html, I have trained a NN using X_T and Y_T.
% Cell arrays inputs for NN
X = tonndata(X_TR,false,false);T = tonndata(Y_TR,false,false); %output volumes
% training function
trainFcn = 'trainlm'; % Levenberg-Marquardt
% Create NARX
% network parameters
lags = 10;inputDelays = 1:lags;feedbackDelays = 1:lags;hiddenLayerSize = 40;% construct NARX net
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);%prepare time series
[x,xi,ai,t] = preparets(net,X,{},T);% Training, Validation, Testing
net.divideParam.trainRatio = 60/100;net.divideParam.valRatio = 20/100;net.divideParam.testRatio = 20/100;% Train the Network
[net,tr] = train(net,x,t,xi,ai);
I don't know how to apply the trained model. Let say that the training was successful and I would like to apply the model on the other part of the data X_APP and Y_APP such that it predicts Y_APP(t+1). How could I do it?
Thank you.
Best Answer