Use of target data in closed loop NARX network

3 views (last 30 days)
I have a question regarding NARX network.
I have created a NARX network (see below) and that works fine. Also if I provide new data that has not been use for training I get good results. The network has one input X and one output Y.
inputDelays = 1:15; %20 feedbackDelays = 1:15; %20 hiddenLayerSize = 25; %25
net1 = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
[inputs,inputStates,layerStates,targets] = preparets(net1,inputSeries(1:20000),{},targetSeries(1:20000));
net1.divideParam.trainRatio = 70/100; net1.divideParam.valRatio = 15/100; net1.divideParam.testRatio = 15/100;
[net1,tr] = train(net1,inputs,targets,inputStates,layerStates); outputs = net1(inputs,inputStates,layerStates);
Then I want to use the NARX network as closed. I use a delay of 15 to preparing the inputStates. Then I want to use the NARX network and the X input variable to create the Y variable.
netc = closeloop(net1);
index = 1600;
[inputs,inputStates,layerStates,targets] = preparets(netc,inputSeries(index-15-4+1:index),{},targetSeries(index-15-4+1:index));
outputs = netc(inputs,inputStates,layerStates);
When I use this code I get a good starting condition/layerStates conform the data. Then I use the next four X inputs inputSeries(index-3:index) (inputs) and the NARX network to calculate the next four Y outputs targetSeries(index-3:index) (targets).
I would expect that the calculation of the output is independed on targetSeries(index-3:index) because it should be depended on the starting condition layerStates and inputSeries(index-3:index).
However when the targetSeries(index-3:index) has different value also the output values of the NARX closed network is different. It looks like that targetSeries(index-3:index) is somehow used in the calculation and this is not desired. Does anyone have any idea what goes wrong?
Many thanks in advance and best wishes

Answers (0)

Community Treasure Hunt

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

Start Hunting!