How can I improve my code?

%Step1:Load a dataset
load thyroid_dataset;
inputs = thyroidInputs;
targets = thyroidTargets;
%Step2:create Multi ANN
hiddenLayerSize = 20;
Numb_Ag = 7; %num of agents
Numb_round = 2;
for i=1:Numb_round
for j=1:Numb_Ag
%create a pattern recognition network
net= feedforwardnet(hiddenLayerSize);
%Step3:Training
[Anet{i},tr{i}] = train(net,inputs, targets); %Training
vperf(i,j)= (1-tr{i}.best_vperf)*100;
if (j==Numb_round) && (vperf(i,j)< vperf(i,j))
while(1)
net= feedforwardnet(hiddenLayerSize);
[Anet{i},tr{i}] = train(net,inputs, targets); %Training
vperf(i,j)= (1-tr{i}.best_vperf)*100;
if vperf(i,j)>= vperf(i,1)
break;
end
end
end
end
end
[verf BestAg]= max(vperf(:,2));
net = [];
net = Anet{BestAg,1}
output = net(inputs);
%steps4 : zero -sum strategy
[verfBestANN_id] = max(vperf);
%Steps 5 Test with best ANN
outputs = net{BestANN_id}(inputs);
accuracy_performance = (1-perform(net{BestANN_id}, targets, outputs))*100 ;
How can I improving this code in terms of algorithm design and analysis?

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by