# How retrain yet trained closed loop NAR

1 view (last 30 days)
EanX on 1 Oct 2015
I want to retrain a yet trained closed loop NAR (to improve performance), but how?
Below my code.
% from open loop neto to closed
netc=closeloop(neto,Xoi,Aoi);
[Xc,Xci,Aci,Tc]=preparets(netc,{},{},T);
[Yc,Xcf,Acf]=netc(Xc,Xci,Aci);
Ec=gsubtract(Tc,Yc);
% some error metric
NMSEc=mse(Ec)/varto;
Ectrn=Ec(trnind);
Ecval=Ec(valind);
Ectst=Ec(tstind);
NMSEctrn=mse(Ectrn)/var(totrn,1);
NMSEcval=mse(Ecval)/var(toval,1);
NMSEctst=mse(Ectst)/var(totst,1);
R2ctrn = 1 - mse( Ectrn )/var(totrn,1);
R2cval = 1 - mse( Ecval )/var(toval,1);
R2ctst = 1 - mse( Ectst )/var(totst,1);
R2c = 1 - mse( Ec )/varto;
%%Retrain NAR
% [Xc, Xci, Aci,Tc ] = preparets(netc,{},{},T); % I think this is not necessary
% netc=configure(netc,Xc,Tc); % even this seems useless
% netc.trainFcn='trainlm'; % if I not change algorithm training stops after 3 or 4 iterations
% retrain using Xcf and Acf from netc output states?
[netcr,trcr, Ycr, Ecr, Acfr, Xcfr] = train(netc,Xc,Tc,Xcf,Acf);
NMSEcr=mse(Ecr)/varto;
R2cr = 1 - mse( Ecr )/varto;
Thanks!