gongpan126 发表于 2006-8-5 17:00

请高手帮助解读遗传算法优化神经网络程序

% 用GA训练BP网络的权值、阈值
tic, % 开始计时
=nninit; % BP网络初始化
aa=ones(S,1)*[-1 1];
popu=60; % 初始种群个数
initPpp=initializega(popu,aa,'gabpEval');
gen=700; % 遗传代数
=ga(aa,'gabpEval',[],initPpp,,'maxGenTerm',gen,...
'normGeomSelect',,['arithXover'],,'nonUnifMutation',);
%%Lets take a look at the performance of the ga during the run
subplot(2,1,1)
plot(trace(:,1),1./trace(:,3),'r-')
hold on
plot(trace(:,1),1./trace(:,2),'b-')
xlabel('Generation');
ylabel('Sum-Squared Error');
subplot(2,1,2)
plot(trace(:,1),trace(:,3),'r-')
hold on
plot(trace(:,1),trace(:,2),'b-')
xlabel('Generation');
ylabel('Fittness');
% 从编码x中解码出BP网络所对应的权值、阈值
=gadecod(x);
% 仿真结果
TT=simuff(P,W1,B1,'tansig',W2,B2,'purelin')
toc % 结束计时

其中,=ga(aa,'gabpEval',[],initPpp,,'maxGenTerm',gen,...
'normGeomSelect',,['arithXover'],,'nonUnifMutation',);
%%Lets take a look at the performance of the ga during the run
subplot(2,1,1)
plot(trace(:,1),1./trace(:,3),'r-')
hold on
plot(trace(:,1),1./trace(:,2),'b-')
xlabel('Generation');
ylabel('Sum-Squared Error');
subplot(2,1,2)
plot(trace(:,1),trace(:,3),'r-')
hold on
plot(trace(:,1),trace(:,2),'b-')
xlabel('Generation');
ylabel('Fittness');这几句怎么理解,请高手指点.

[ 本帖最后由 cdwxg 于 2006-8-5 19:27 编辑 ]
页: [1]
查看完整版本: 请高手帮助解读遗传算法优化神经网络程序