Info

This question is closed. Reopen it to edit or answer.

I want to average multiple NARX networks on the same set of input-targets: Am I doing it right?

2 views (last 30 days)
Here's the relevant chunk of code:
numNN = 100;
j=1; % Prepare average cell arrays [Xc,Xic{j},Aic{j},Tc] = preparets(netc,X,{},T);
Xic{j}={0}; Aic{j}={0};
[Xict_,iX,jX] = nncell2mat(Xic{j}); [Aict_,iA,jA] = nncell2mat(Aic{j});
j=0; for i = 1:numNN
% Prepare the Network
[Xc,Xic{i},Aic{i},Tc] = preparets(netc,X,{},T);
% Train the Network
netf = train(netc,Xc,Tc,Xic{i},Aic{i});
Yc = netf(Xc,Xic{i},Aic{i});
closedLoopPerformance = perform(netf,Tc,Yc);
tc = cell2mat(Tc);
vartc = mean(var(tc',1));
Ec = gsubtract(Tc,Yc);
NMSEc = mse(Ec)/vartc
[Xic_,iX,jX] = nncell2mat(Xic{i});
[Aic_,iA,jA] = nncell2mat(Aic{i});
if(NMSEc<2.0e-3)
j=j+1;
Xict_= Xict_ + Xic_;
Aict_= Aict_ + Aic_;
end
[i j]
end
Xict_=Xict_/j; Aict_=Aict_/j;
Xfc = mat2cell(Xict_,iX,jX); Afc = mat2cell(Aict_,iA,jA);
% Multi-step Prediction
X2 = X1(1, 1); Y2 = netf(X2,Xfc,Afc); Ypred(1)=Y2; % % % %
Any input is appreciated, thank in advance for your time. Please let me know if you need any additional information.

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!