|
楼主 |
发表于 2006-8-15 17:06
|
显示全部楼层
在用bp模型进行预测时,误差会特别大!甚至出现的结果不能叫误差!
load p50.mat
load t50.mat
p=p50',
t=t50',
net=newff(minmax(p),[7,1],{'tansig','purelin'},'trainlm');
net=initlay(net);
给权值阀值赋值
inputWeights=[3.122779048171,2.255821869611891,3.799706272202788,-3.66328379887522,-0.545092237633623,3.850681563493402,-0.538975079106648,-0.718962003134425,10.03521227649018;-1.761375571152317,-0.366494400559514,3.435168067936286,-2.847417329424111,4.048425174977655,-5.166011915728258,-0.808441534152644,2.009610223607288,4.775194687923136;1.107981076557102,1.211046317885484,-1.170341820738418,-4.56860778268783,-0.504666633461631,3.08599919324985,-1.264138669177781,3.12492704492211,-7.455148571649823;-0.15386210628244,3.241862547606278,5.434479737455827,1.665920020629382,-1.277867959435772,-2.171602576084157,0.795321280377629,0.875055964684542,-10.49968887649099;2.753069487724973,3.002435347684374,-3.912241229692641,-2.343761064008628,3.486003720320172,3.832166731664813,-0.551788335179388,-0.020667647287911,-5.082847232930414;2.719543971255148,2.500544231721904,-1.92012347156305,-4.569796167767257,0.373491608559365,0.047912726851151,0.171939918021146,3.534398983839914,1.608614128681488;-0.310499859136641,-2.336053730703718,2.809395211360493,-5.05561448959479,-3.035195653935498,2.452668883245069,-0.990174303405127,1.954685186786508,7.369234137822707;-3.856961827394375,-0.764153619600216,-4.938094828722757,2.890682595198744,1.973300336924911,-0.935046743803598,0.630338068416335,0.989062647616526,-6.949538054496057;]
inputbias=[-9.854436918404796;3.570030805596352;-1.773581770780901;-4.557901632847051;-5.862101554924009;-6.635235020149124;2.115174813461072;4.275858630573478;]
layerWeights=[0.676992089876161,0.136144922015552,-0.259172886735767,0.405479826480754,0.093142303658212,-0.110239590654176,0.389134480851095,0.242620261590827;]
layerbias=[0.589642160401853;]
inputWeights=net.IW{1,1}
inputbias=net.b{1}
layerWeights=net.LW{2,1}
layerbias=net.b{2}
net.trainParam.epochs=2000;
net.trainParam.goal=0.1;
net.performFcn = 'msereg';
net.trainParam.show=100;
net=train(net,p,t);
a=sim(net,p);
E=t-a;
MSE=mse(E);
e=abs((t-a)./t);
figure(3)
[m,b,r]=postreg(a,t);
figure(4)
i=1:1:50;
plot(i,t,'+',i,a,'o','MarkerSize',3);
p_test=[1.255,1.264,1.297;0.207,0.223,0.205;0.72,0.74,0.98;0.429,0.44,0.357;0.161,0.081,0.148];
t_test=sim(net,p_test);
这是我的程序代码
我在预测时,调一组数据进行预测,数据不是50组中的,预测结果误差特大
为什么会出现这样的问题呢? |
|