声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1833|回复: 0

[人工智能] 如何解决神经网络训练值为正但模拟值有负值的问题

[复制链接]
发表于 2008-4-27 19:55 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
请教个问题:训练的数集都是正值,但模拟出来的有些负值,不符合实际情况,请大家帮忙看看。

  谢谢!附件里面是数据和程序。

  下面是训练模拟时的主要程序,请帮忙看看有没问题。

   net=newff(minmax(P_train),[16,8,1],{'tansig','tansig','purelin'},'traingdx');
    net.trainparam.epochs=400;
    net.trainparam.goal=0.0001
    net.trainparam.show=50;
    net=train(net,P_train,T_train)
    T_moni=sim(net,P_test)

——————————————————————————————————————————————————
以下为附件内容:
现在有个问题:T_moni 的值有几个是负的,而 T_moni 代表的是生物量,不应该为负,请帮忙看下是怎么回事,是不是程序有问题,谢谢!
size(P_train)=[1,112]  
size(T_train)=[1,112]   
size(P_test)=[1.56]  
size(T_test)=[1.56]
下面是数据:
  1. P_train = [0.008662434 0.033743759 0.055811172 0.005937322 0.002575783 0.036466071 0.044155905 0.019700634 0.051327317 0.037565029 0.025642779 0.037749355 0.00843857 -5.85657E-06 0.108041267 0.102046618 0.253090739 0.069778002 0.110318322 0.157306449 0.227409147 0.117720152 0.20464526 0.132722686 0.063227596 0.156450342 0.056464958 0.057270238 0.232589872 0.194712289 0.368684447 0.108509033 0.220799348 0.25914446 0.40389676 0.338495969 0.399126218 0.304627662 0.217756414 0.406850839 0.079795361 0.073202986 0.397881617 0.313364362 0.650305412 0.272594278 0.303458271 0.408034985 0.565355186 0.500879897 0.60403673 0.532982001 0.48712883 0.500681325 0.245333203 0.169574184 0.537665842 0.567597311 0.406860468 0.422401784 0.465689872 0.363069036 0.552937441 0.380518257 0.657144928 0.621928925 0.544031326 0.603645472 0.373423045 0.378849107 0.453827638 0.522279704 0.434981532 0.53807692 0.316305067 0.288329639 0.436676005 0.446361775 0.532398779 0.528188062 0.501559261 0.511721399 0.385581821 0.449908114 ...
  2. 0.443434207 0.534924553 0.468376211 0.413218912 0.243518077 0.244016874 0.416792524 0.408573849 0.672960872 0.638075267 0.490768006 0.460205496 0.342284412 0.372193559 0.377480809 0.393577256 0.364548686 0.348557528 0.136378274 0.212248974 0.250443603 0.239973058 0.341927986 0.378867566 0.278575626 0.298866971 0.251310635 0.25147113];

  3. T_train = [0.004749474 0.004906667 0.006703313 0.002257333 0.002533108 0.010816941 0.009142367 0.005037055 0.005767619 0.003008364 0.003651111 0.005619 0.003325818 0.001614194 0.006231611 0.007280622 0.015900014 0.005462801 0.011082758 0.013100739 0.013292323 0.01217091 0.0111332 0.007789229 0.007522472 0.012322123 0.005400399 0.005824971 0.014311411 0.011961137 0.022485539 0.011199144 0.018033758 0.020280868 0.019878343 0.020374429 0.017925359 0.012102891 0.014885847 0.019545302 0.012198029 0.013406449 0.012554624 0.009720887 0.011665018 0.008058492 0.010382035 0.012149144 0.01517445 0.016027216 0.01444982 0.009938811 0.013665846 0.014821038 0.010654038 0.009720438 0.040135654 0.038845935 0.042548553 0.032330928 0.045401446 0.028217936 0.026603914 0.027366947 0.044982863 0.036160721 0.047392765 0.047607038 0.035376514 0.035216066 0.027225248 0.039679443 0.031005953 0.047217 0.055648583 0.025470675 0.035274754 0.039376083 0.049283542 0.035413529 0.035184651 0.06307433 0.042144956 0.02904106 ...
  4. 0.055755741 0.084309431 0.052566774 0.053894066 0.068860072 0.073057813 0.092129292 0.082896605 0.083923453 0.061272559 0.076507886 0.075088686 0.055873645 0.04614525 0.065520014 0.116630832 0.082792218 0.093216739 0.087164016 0.084272499 0.093218219 0.071587817 0.108302945 0.058095544 0.068349428 0.072534823 0.064411513 0.07564202];

  5. P_test = [0.049661129 0.020895819 0.049381124 0.005251999 0.038805756 0.009524988 0.002752217 0.136175133 0.156000999 0.278765081 0.055025222 0.072025095 0.067428084 0.04539748 0.388236865 0.315994014 0.600986138 0.08959729 0.197815032 0.166870368 0.111947893 0.541650493 0.619751783 0.627711928 0.441154557 0.408062855 0.415362066 0.228291139 0.606496806 0.591666975 0.489524306 0.292571268 0.50231103 0.409836395 0.329778873 0.480444093 0.552829801 0.466630254 0.29229239 0.463017324 0.492661955 0.307724772 0.422725919 0.483587627 0.344107739 0.314659939 0.999998096 0.549940255 0.347256653 0.326481532 0.383527118 0.261492411 0.289293876 0.355225058 0.293763029 0.291845696];

  6. T_test = [0.007949818 0.003214667 0.008988853 0.002305481 0.006896667 0.001381 0.003053803 0.014001428 0.0115781 0.019308229 0.009736999 0.008333827 0.007060891 0.005378038 0.025371056 0.019679952 0.027102208 0.011692457 0.017252874 0.011742803 0.011558292 0.012714809 0.014096942 0.020593828 0.01423976 0.012722177 0.011468614 0.011067677 0.045482251 0.04504126 0.053199424 0.028592799 0.040734194 0.033812758 0.037701066 0.037497726 0.03339277 0.065119191 0.034097521 0.041507555 0.043467497 0.040041707 0.063087299 0.085329493 0.105092997 0.068057721 0.075350735 0.078260659 0.055628515 0.093711183 0.088812727 0.084067849 0.09426202 0.089285426 0.089584496 0.073798494];
复制代码
  1. %第一步,采用不同的网络结构训练,得到网络误差最小的一个网络结构
  2. s=3:10;
  3. res=1:8;
  4. for i=1:8
  5. net=newff(minmax(P_train),[s(i)*2,s(i),1],{'tansig','tansig','purelin'},'traingdx');
  6. net.trainparam.epochs=300;
  7. net.trainparam.goal=0.0001
  8. net=train(net,P_train,T_train)
  9. y=sim(net,P_train);
  10. error=y-T_train;
  11. res(i)=norm(error);
  12. end
  13. no=find(res==min(res));
  14. nunber=s(no)


  15. %%第二步,用得到网络误差最小的一个网络结构,训练并模拟得到验证结果。
  16. net=newff(minmax(P_train),[16,8,1],{'tansig','tansig','purelin'},'traingdx');
  17. net.trainparam.epochs=400;
  18. net.trainparam.goal=0.0001
  19. net.trainparam.show=50;
  20. net=train(net,P_train,T_train)
  21. T_moni=sim(net,P_test)
复制代码

[ 本帖最后由 eight 于 2008-4-28 18:28 编辑 ]

问题请教.txt

4.93 KB, 下载次数: 11

数据及程序

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-29 05:58 , Processed in 0.057725 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表