用matlab做神经网络BP,调了很多参数,误差始终达不到目标值并且始终为同一个数。帮忙看一看,谢谢。。。
x=2001:2011;y=[9438.310552.11243015490.718468.321846.725887.731072.133805.339416.2454...
x=2001:2011;
y=[9438.3 10552.1 12430 15490.7 18468.3 21846.7 25887.7 31072.1 33805.3 39416.2 45429.2];
[xn,minx,maxx,yn,miny,maxy]=Premnmx(x,y) %对数据归一化变为(-1,1)之间的数据;
x1=2012:2015;%检验数据
net=newff(minmax(x),[3,1],{'tansig','purelin'},'trainlm');%创建神经网络
net.trainParam.show=100;
net.trainParam.lr=0.01;
net.trainParam.epochs=15000;
net.trainParam.goal=0.2;
net=init(net);
net=train(net,xn,yn);%训练神经网络
x2n=tramnmx(x1,minx,maxx);%将测试样本数据进行归一化处理
z2n=sim(net,x2n);%对测试样本数据仿真得到预测值
z2=postmnmx(x2n,miny,maxy);%对预测值进行反归一化
xn =
Columns 1 through 9
-1.0000 -0.8000 -0.6000 -0.4000 -0.2000 0 0.2000 0.4000 0.6000
Columns 10 through 11
0.8000 1.0000
minx =
2001
maxx =
2011
yn =
Columns 1 through 9
-1.0000 -0.9381 -0.8338 -0.6637 -0.4982 -0.3105 -0.0859 0.2022 0.3541
Columns 10 through 11
0.6659 1.0000
miny =
9.4383e+003
maxy =
4.5429e+004
TRAINLM, Epoch 0/15000, MSE 2.2677/0.2, Gradient 29.939/1e-010
TRAINLM, Epoch 3/15000, MSE 0.415751/0.2, Gradient 2.22045e-015/1e-010
TRAINLM, Minimum gradient reached, performance goal was not met.
>> plot(x1,z2,'+')
>> z2
z2 =
1.0e+004 *
4.9028 5.2627 5.6226 5.9826 展开
y=[9438.3 10552.1 12430 15490.7 18468.3 21846.7 25887.7 31072.1 33805.3 39416.2 45429.2];
[xn,minx,maxx,yn,miny,maxy]=Premnmx(x,y) %对数据归一化变为(-1,1)之间的数据;
x1=2012:2015;%检验数据
net=newff(minmax(x),[3,1],{'tansig','purelin'},'trainlm');%创建神经网络
net.trainParam.show=100;
net.trainParam.lr=0.01;
net.trainParam.epochs=15000;
net.trainParam.goal=0.2;
net=init(net);
net=train(net,xn,yn);%训练神经网络
x2n=tramnmx(x1,minx,maxx);%将测试样本数据进行归一化处理
z2n=sim(net,x2n);%对测试样本数据仿真得到预测值
z2=postmnmx(x2n,miny,maxy);%对预测值进行反归一化
xn =
Columns 1 through 9
-1.0000 -0.8000 -0.6000 -0.4000 -0.2000 0 0.2000 0.4000 0.6000
Columns 10 through 11
0.8000 1.0000
minx =
2001
maxx =
2011
yn =
Columns 1 through 9
-1.0000 -0.9381 -0.8338 -0.6637 -0.4982 -0.3105 -0.0859 0.2022 0.3541
Columns 10 through 11
0.6659 1.0000
miny =
9.4383e+003
maxy =
4.5429e+004
TRAINLM, Epoch 0/15000, MSE 2.2677/0.2, Gradient 29.939/1e-010
TRAINLM, Epoch 3/15000, MSE 0.415751/0.2, Gradient 2.22045e-015/1e-010
TRAINLM, Minimum gradient reached, performance goal was not met.
>> plot(x1,z2,'+')
>> z2
z2 =
1.0e+004 *
4.9028 5.2627 5.6226 5.9826 展开
展开全部
net=newff(minmax(x),[3,1],{'tansig','purelin'},'trainlm');%创建神经网络
把'purelin'改为'logsig'或'tansig'试试。
把'purelin'改为'logsig'或'tansig'试试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你把待检验的数据发给我liruibdwdm@yeah.net
我给你编写一个吧
你用的函数比较过时了
我给你编写一个吧
你用的函数比较过时了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询