⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gabppp.m

📁 关于遗传算法优化BP网络的 ,感觉没什么用
💻 M
字号:
[P,T,R,S1,S2,Q,S]=nninit; % BP网络初始化
aa=ones(S,1)*[-1 1];
popu=60;
initPpp=initialize(popu,aa,'gabpEval');
gen=1000;
[x endPop bPop trace]=ga(aa,'gabpEval',[],initPpp,[1e-6 1 1],'maxGenTerm',gen,...
   'normGeomSelect',[0.09],['arithXover'],[2],'nonUnifMutation',[2 gen 3]);
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');
[W1 B1 W2 B2]=gadecod(x);
net=newff(minmax(P),[S1 S2],{'tansig' 'purelin'},'trainlm');
net.iw{1,1}=W1;
net.lw{2,1}=W2;
net.b{1}=B1;
net.b{2}=B2;
net=train(net,P,T);
% 仿真结果
TT=sim(net,P)
T

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -