Train closed-loop narnet using composite array?
1 view (last 30 days)
Show older comments
Dear all,
I am using neural network time-series NARNET for predicting the future value. To do so, I need to train the closed-loop neural network. Due to RAM limitations, system requires using composite array.
Data series (having mean = 0 and var =1) looks like below:
Can Someone please suggest how to use composite array for closed-loop NARNET network. Below is my code and data:
T=tonndata(data(1:end,1),false,false);%convert the data into neural input format
delay=[1:481]; %value of delay found using autocorrelation
hiddenlayersize=6; %found using hit and trial (optimum for our application)
trainFcn='trainlm';
net=narnet(delay,hiddenlayersize,'open',trainFcn);
net.trainParam.epochs = 1000;
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'time'; % Divide up every sample
net.divideParam.trainRatio = 96/100;
net.divideParam.valRatio = 2/100;
net.divideParam.testRatio = 2/100;
net.trainParam.min_grad=1e-7;
net.trainParam.max_fail=500;
net.performFcn = 'mse';
net.performParam.normalization = 'standard';
net.input.processFcns={'removeconstantrows','mapminmax'}
[Xso,Xio,Aio,Tso]=preparets(net,{},{},T);
rng('default')
net=train(net,Xso,Tso,Xio,Aio,'useParallel','yes');
[Yso,Xfo,Afo]=net(Xso,Xio,Aio);
[netc,Xic,Aic]=closeloop(net,Xfo,Afo);
[Xc,Xic,Aic,Tc] = preparets(netc,{},{},T);
rng('default')
xc = Composite;
tc = Composite;
xic=composite;
aic=composite;
xc{1} = Xc(0:500);
xc{2} = Xc(500:773);
tc{1} = Tc(0:500);
tc{2} = Tc(500:773);
xic=Xic(1:end);
aic=Aic(1:end);
netc=train(netc,xc,tc,xic,aic);
Since netc is NARNET closed loop, so size(Xc) is 0*773. Due to this I am not able to define xc as composite.
0 Comments
Answers (0)
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!