- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
gafault.m
资源名称:GA-bp.rar [点击查看]
上传用户:szhysm888
上传日期:2008-07-11
资源大小:35k
文件大小:1k
源码类别:
人工智能/神经网络
开发平台:
Matlab
- % 用GA训练BP网络的权值、阈值
- tic, % 开始计时
- [P,T,R,S1,S2,S]=nninit; % BP网络初始化
- aa=ones(S,1)*[-1 1];
- popu=60; % 初始种群个数
- initPpp=initializega(popu,aa,'gabpEval');
- gen=700; % 遗传代数
- [x endPop bPop trace]=ga(aa,'gabpEval',[],initPpp,[1e-6 1 1],'maxGenTerm',gen,...
- 'normGeomSelect',[0.09],['arithXover'],[2],'nonUnifMutation',[2 gen 3]);
- %%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网络所对应的权值、阈值
- [W1 B1 W2 B2]=gadecod(x);
- % 仿真结果
- TT=simuff(P,W1,B1,'tansig',W2,B2,'purelin')
- toc % 结束计时