MATLAB: Neural Network Times Series ahead prediction in Matlab, how to build input and output data

Deep Learning Toolboxneural networktime series

My goal is to predict N steps ahead with neuaral network in matlab. In order to do that first I train some part of the data and use trained values to predict the future behavior of it.
My question is based on Neural Network Times Series prediction on matlab. I was confused on how should I separate my Input and Output data and based on the difference between feedbackDelays and inputDelays.
As an Example: My Data is: [values are actually index values within the data] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] And I want to predict 5 point ahead of each 10 input which is:
[1,2,3,4,5,6,7,8,9,10] => [15]
[2,3,4,5,6,7,8,9,10,11] => [16]
[3,4,5,6,7,8,9,10,11,12] => [17]
and so on…
Matlab isn't like octave, I won't able to see the and analysis the Input data set and double check. In order to to this, how should my following code should be for function narxnet:
**delay** = 5; % //Does delay means number of input??
neuronsHiddenLayer = 50;
% Network Creation

net = narxnet(1:delay,1:delay,neuronsHiddenLayer); %=> Does is really do what I want to do as I decribed on above.
=====
X = S(1:length(S)-N); T = S(N:length(S));
for example length(S) is 5 X = [1,2,3,4,5] T = [6,7,8,9,10,11,12 …]
I want to do that from the data of X if my input is *3*:
[1,2,3] => [6] //first data of T which is my output
[2,3,4] => [7] //second data of T which is from my output
=> On my code did I able to perform this solution, if not what should I do to achieve this solution?
=>If my output are in between [0-100], it predicts beyond that, larger values than 100, how it possible? I couldn't find where I make mistakes…
*My code:* My code come ups with a solution but I am not sure that it build the input and output values as I described above.
S = load('newDataSet.txt'); %//sequence of numbers as time series.(attached)
N = 5; %//5 points ahead will be predicted
X = S(1:length(S)-N); %//I think that it separates my input and output
T = S(N:length(S));
X = X';
T = T';
X = num2cell(X);
T = num2cell(T);
%%2. Data preparation
% Multi-step ahead prediction
% Input and target series are divided in two groups of data:
% 1st group: used to train the network
inputSeries = X(1:length(X)-N);
targetSeries = T(1:length(X)-N);
% 2nd group: this is the new data used for simulation. inputSeriesVal will
% be used for predicting new targets. targetSeriesVal will be used for
% network validation after prediction
inputSeriesVal = X(length(X)-N+1:length(X));
targetSeriesVal = T(length(X)-N+1:length(X)); % This is generally not available
%%3. Network Architecture
delay = 5;
neuronsHiddenLayer = 50;
% Network Creation
net = narxnet(1:delay,1:1,neuronsHiddenLayer); *%1:1 correct for 1 output?*
%%4. Training the network
[Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries);
net = train(net,Xs,Ts,Xi,Ai);
view(net);
Y = net(Xs,Xi,Ai);
% Performance for the series-parallel implementation, only
% one-step-ahead prediction
perf = perform(net,Ts,Y);
%%5. Multi-step ahead prediction
inputSeriesPred = [inputSeries(end-delay+1:end),inputSeriesVal];
targetSeriesPred = [targetSeries(end-delay+1:end), con2seq(nan(1,N))];
netc = closeloop(net);
view(netc);
[Xs,Xi,Ai,Ts] = preparets(netc,inputSeriesPred,{},targetSeriesPred);
yPred = netc(Xs,Xi,Ai);
perf = perform(net,yPred,targetSeriesVal);
figure;
plot([cell2mat(targetSeries),nan(1,N);
nan(1,length(targetSeries)),cell2mat(yPred);
nan(1,length(targetSeries)),cell2mat(targetSeriesVal)]')
legend('Original Targets','Network Predictions','Expected Outputs')

Best Answer

Perhaps you did not understand me:
I do not understand what you want.
An example using a MATLAB data would clarify the issue.
However, since you have submitted a single series example, there is only one function to use:
help narnet
doc narnet
A selection of effective feedback delays can be obtained from the significant values of the series autocorrelation function. For examples search using
greg nncorr
Thank you for formally accepting my answer
Greg