clear all
close all
g = gpuDevice(1);
reset(g);
FD=1:50;
T = solar_dataset;
T=[T T T T T T T T T T];
neu=10;
tic
rng('default');
for Ntrials=1:3
net = narnet(FD,neu);
net.trainFcn ='trainscg';
for i=1:net.numLayers
if strcmp(net.layers{i}.transferFcn,'tansig')
net.layers{i}.transferFcn = 'elliotsig';
end
end
[Xo,Xoi,Aoi,To] = preparets(net,{},{},T);
net = configure(net,Xo,To);
Xo = nndata2gpu(Xo,'single');
To = nndata2gpu(To,'single');
Xoi = nndata2gpu(Xoi,'single');
Aoi = nndata2gpu(Aoi,'single');
[ net] = train(net,Xo,To,Xoi,Aoi);
Yo = net(Xo,Xoi,Aoi);
Yo=gpu2nndata(Yo);
To=gpu2nndata(To);
Eo = gsubtract(To,Yo);
clear net
reset(g);
Ntrials
end
toc
clearvars -except FD T neu
tic
rng('default');
for Ntrials=1:3
net = narnet(FD,neu);
net.trainFcn ='trainscg';
for i=1:net.numLayers
if strcmp(net.layers{i}.transferFcn,'tansig')
net.layers{i}.transferFcn = 'elliotsig';
end
end
[Xo,Xoi,Aoi,To] = preparets(net,{},{},T);
net = configure(net,Xo,To);
[ net] = train(net,Xo,To,Xoi,Aoi);
Yo = net(Xo,Xoi,Aoi);
Eo = gsubtract(To,Yo);
clear net
Ntrials
end
toc