神经网络精度达到了,但是训练样本时预测值很不准。
Show older comments
大家好,我想问一下,这是什么原因造成的,该如何解决,我在用神经网络学习样本时精度已达到要求,但是训练时发现与真实值差别很大,这是为什么呢?我的代码如下:
P=[-1,-0.928571,-0.857143,-0.785714,-0.714286,-0.642857,-0.5,-0.428571,-0.357143,-0.214286,-0.142857,-0.0714286,0,0.0714286,0.142857,0.285714,0.357143,0.428571,0.5,0.571429,0.642857,0.785714,0.857143,0.928571,1;-1,-0.970588,-0.941176,-0.911765,-0.882353,-0.852941,-0.794118,-0.764706,-0.735294,-0.676471,-0.647059,-0.617647,-0.588235,-0.558824,-0.529412,-0.470588,-0.441176,-0.411765,-0.382353,-0.352941,-0.323529,-0.264706,-0.352941,-0.205882,-0.176471;-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;-1,-0.984848,-0.924242,-0.884848,-0.848485,-0.80303,-0.727273,-0.69697,-0.560606,-0.287879,-0.151515,-0.106061,-0.0606061,-0.0151515,0.030303,0.0909091,0.136364,0.181818,0.227273,0.272727,0.318182,0.545455,0.69697,0.848485,1];
T=[0.299353,0.1,0.199029,0.224919,0.249515,0.131715,0.134951,0.202913,0.369256,0.336246,0.633333,0.202265,0.465696,0.399029,0.20356,0.156958,0.652751,0.133657,0.479935,0.101294,0.243042,0.704531,0.613916,0.756311,0.9;0.1,0.285636,0.27241,0.307512,0.340645,0.474806,0.56703,0.557926,0.248696,0.337998,0.204276,0.49763,0.354778,0.417996,0.594394,0.694306,0.389227,0.775082,0.9,0.863782,0.766917,0.506283,0.581703,0.522699,0.469325];
NodeNum=30;
TypeNum=2;
TF1='logsig';TF2='logsig';
net=newff(minmax(P),[NodeNum TypeNum],{TF1,TF2},'trainlm');
net.trainParam.epochs = 10000; %最大训练轮回
net.trainParam.goal = 1e-4;
net = train(net,P,T);
P_test=[-0.571429,-0.285714,0.214286,0.714286;-0.823529,-0.705882,-0.5,-0.294118;-1,1,1,1;-0.757576,-0.424242,0.0606061,0.363636];
x=sim(net,P_test)
x =
0.1111 0.3975 0.1008 0.5377
0.5515 0.2695 0.7173 0.5972
而我的样本值为
x=0.446602 0.610841 0.026699 0.673948
0.302533 0.163908 0.694006 0.519865
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!