资源描述:
《matlab的bp神经网络各种不同算法程序》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Matlab的BP神经网络各种不同算法程序1:一般模式的BP: clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traingd'); net.trainParam.show=50; net.trainParam.lr=0.05; net.trainParam.epochs=300; net.trainParam.goal=1e-5 [nettr]=train(net,P,T);
2、2:加入动量的BP clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traingdm'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.mc=0.9; net.trainParam.epochs=10000; net.trainParam.goal=1e-5*100 [nettr]=train
3、(net,P,T); 3:自适应LR变步长: clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traingda'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.05; net.trainParam.epochs=10000; net.trainParam.goal=1e-5
4、*100 [nettr]=train(net,P,T); 4:弹性梯度法 clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'trainrp'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.05; net.trainParam.epochs=10000; net.trainP
5、aram.goal=1e-5*100 [nettr]=train(net,P,T); 5:共轭梯度1 clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traincgf'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.05; net.trainParam.epochs=100
6、00; net.trainParam.goal=1e-5*100 [nettr]=train(net,P,T); 6:共轭梯度2 clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traincgp'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.05; net.trainP
7、aram.epochs=10000; net.trainParam.goal=1e-5*100 [nettr]=train(net,P,T); 7:共轭梯度3 clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traincgb'); net.trainParam.show=10000; net.trainParam.lr=0.05; net.trainParam.lr_inc=1.
8、05; net.trainParam.epochs=10000; net.trainParam.goal=1e-5*100 [nettr]=train(net,P,T); 8:共轭梯度4 clc P=[-1-122;0505]; T=[-1-111]; net=newff(minmax(P),[3,1],{'tansig','purelin'},'traincgb');