调整参数对bp网络的影响,具体如下:
clc;
clear;
x=1:1:79;
P=rands(1,79);
% T=rands(1,79);
T=ones(1,79);
net=newff(minmax(P),[25,1],{'tansig','purelin'},'trainlm');
net.trainParam.show=50;
net.trainParam.epochs=200;
net.trainParam.goal=0.01;
net=train(net,P,T);
y=sim(net,P);
%%%%%%%%%%%%%%%%%%%%%%调整参数后,epochs变大,goal变小。
net2=newff(minmax(P),[25,1],{'tansig','purelin'},'trainlm');
net2.trainParam.show=50;
net2.trainParam.epochs=200;
net2.trainParam.goal=0.00000001;
net2=train(net2,P,T);
y2=sim(net2,P);
%%%%%%%%绘制效果
plot(x,T,'r*');
hold on
plot(x,y,'g*');
plot(x,y2,'b*');
% axis([0 80 0.999 1.001]);
legend('目标值','第一次模拟效果','第二次模拟效果','Location','NorthWest');
hold off;