I have trained a NARXNET to the point where I’m satisfied with its performance, but almost every time I convert the net into closed loop form to predict ahead without targets the first few values that are being predicted are way off where they should be – if I’m for example simulating 60 steps ahead with external predictors, it is very common that the first 1:5 predictions are much less accurate than the remaining 6:60.
I suspect that this problem has to do with the layer states that I’m using in the closed loop simulation, I read a post made some time ago by Mark Hudson Beale giving an example as to how to acquire the correct delay states to use in closed loop simulation as:
%(This is just the last part of the example)
% Initial 2nd layer states for closed loop contination will be the
% processed second input's final states. Initial 1st layer states
% will be zeros, as they have no delays associated with them.
Ai2 = cell2mat(Xf(2,:)); for i=1:length(net.inputs{1}.processFcns) fcn = net.inputs{i}.processFcns{i}; settings = net.inputs{i}.processSettings{i}; Ai2 = feval(fcn,'apply',Ai2,settings); end Ai2 = mat2cell([zeros(10,2); Ai2],[10 1],ones(1,2)); % Closed loop simulation on X2 continues from open loop state after X.
Y2 = sim(netc,X2,Xi2,Ai2);
When I run the code on his example it works fine, but since I in my own problem have several external predictors, when I try it there I’m getting an error saying:
Error using mat2cell (line 97)Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [37 2].'
Because what I’m getting out from the loop (Ai2) is a 27×2 matrix that has just been processed by the nets process function mapminmax.
Could someone advise me on how to get the correct delay conditions for closed loop simulation in a situation with multiple external predictors?
Thanks.
Best Answer