问题出现了:BP网络预测
p=[38.04 33.36 42.73 -4.59 1.88 1037.52 5.59 561.37 12.8;30.04 20.8 39.27 -0.83 4.03 1026.27 -12.08 558.49 -3.62;
33.97 30.23 37.71 0.69 1.77 1027.02 0.48 561.05 2.19;
45.21 49.77 40.65 1.74 1.31 1026.18 -1.23 561.31 -0.06;
55.14 57.86 52.41 1.72 -0.02 1028.75 2.45 562.33 1.13;
38.62 43.69 33.54 7.83 5.81 1021.44 -6.74 573.24 11.45;
62.61 62.53 62.69 7.65 0.18 1009.3 -13.04 563.3 -9.36;
59.18 73.92 44.43 -1.51 -8.86 1025.06 14.88 553.5 -10.01;
56.49 60.79 52.2 -4.47 -1.25 1030.27 3.61 551.38 -1.66;
56.78 62.57 50.99 -1.2 3.83 1021.69 -9.86 551.29 -0.93;
49.87 63.14 36.59 2.5 4.44 1018.44 -3.49 554.34 3.33;
47.52 58.74 36.31 6.68 5.15 1012.78 -7.36 559.46 4.25;
62.3 68.23 56.38 2.71 -2.83 1019.46 4.74 557.03 -2.87;
53.7 54.52 52.89 0.23 -1.54 1020.01 -0.51 557.18 -.58;
62.84 92.85 32.84 0.42 1.14 1022.58 1.41 560.1 3.28;
50.51 70.35 30.67 4.55 5.38 1015.5 -9.05 562.69 3.17;
66.05 71.13 60.97 1.66 -1.32 1024.4 5.84 561.99 -0.99;
78.66 89.85 67.47 1.04 0.18 1024.13 -2.42 558.52 -4.71;
77.78 92.48 63.08 0.5 0.37 1019.11 -7.6 552.37 -7.63;
55.35 66.29 44.42 0.43 0.07 1020.8 0.33 555.03 1.99;
41.53 49.72 33.34 2.38 3.24 1018.32 -4.52 557.25 2.25;
42.93 35.44 50.42 1.45 0.09 1021.73 1.16 557.19 -0.22;
54.92 60.97 48.86 5.76 4.6 1011.31 -12.13 554.93 -3.12;
53.76 55.81 51.71 4.62 -0.89 1012.56 0.84 552.75 -2.7;
73.9 89.7 58.1 -1.11 -6.12 1019.29 7.04 547.42 -6.;
57.02 74.74 39.31 -0.65 1.13 1023.8 3.44 553.19 5.6;
33.61 28.19 39.02 -2.48 -0.93 1032.32 7.06 560.99 7.68;
36.81 39.9 33.72 3.64 6.07 1022.1 -10.28 561.76 0.36;
48.17 47.05 49.3 2.72 -1.0 1020.02 -1.44 556.69 -5.11;
29.75 26.48 33.02 7.08 4.71 1019.76 -0.03 568.95 13.53;
23.68 21.71 25.64 10.58 3.38 1016.41 -3.07 569.53 0.7;
21.97 21.36 22.59 13.03 2.82 1014.4 -2.26 572.68 3.49;
21.93 26.28 17.58 15.31 2.08 1009.96 -3.77 569.79 -2.35;
41.43 45.38 37.48 12.27 -3.71 1014.58 6.03 569.0 -0.37;
55.15 59.52 50.78 8.34 -3.65 1019.08 4.24 568.32 -0.45;
27.13 25.04 29.22 11.34 2.59 1019.73 0.63 576.66 7.93;
10.7 6.95 14.45 12.46 1.0 1014.63 -4.62 575.93 -0.73;
46.89 49.29 44.48 10.34 -2.22 1012.03 -2.47 566.91 -9.23;
50.11 61.17 39.04 7.41 -2.08 1015.23 1.8 563.46 -4.06;
37.3 45.24 29.35 7.5 0.23 1018.8 2.77 563.31 -0.15;
55.71 73.36 38.06 5.57 -1.65 1024.2 4.96 562.47 -0.62;
39.35 45.96 32.75 4.82 -0.49 1025.99 0.8 564.18 1.61;
27.86 30.42 25.31 9.64 4.77 1018.79 -7.96 566.52 1.91;
29.34 36.48 22.19 12.5 2.9 1016.04 -3.68 569.08 2.24;
21.98 24.43 19.53 15.5 2.85 1010.13 -5.75 569.05 -0.28;
14.06 15.43 12.68 18.67 2.73 1002.92 -6.93 568.92 -0.39;
22.14 27.71 16.57 18.66 -0.78 1001.77 -0.44 567.27 -1.77;
23.78 27.59 19.97 19.19 0.7 1000.96 -0.86 569.15 1.87;
38.69 47.69 29.7 16.96 -2.97 1005.5 5.74 572.43 4.03;
46.41 56.62 36.21 11.51 -4.66 1014.27 9.02 571.42 0.15;
37.44 47.1 27.77 13.37 2.67 1012.9 -1.71 570.11 -0.44;
30.54 38.93 22.16 17.18 4.22 1005.56 -7.07 571.81 1.85;
25.17 27.85 22.49 16.35 -0.7 1006.04 0.43 570.95 -0.64;
55.39 70.75 40.03 13.13 -3.5 1013.56 7.86 569.9 -0.77;
25.73 30.27 21.19 19.24 5.6 1007.72 -5.84 576.35 0.0;
40.27 42.66 37.87 18.87 -0.62 1002.11 -5.59 573.3 -2.94;
65.9 70.35 61.44 9.47 -10.05 1010.11 8.52 565.62 -7.28;
34.94 40.95 28.93 6.02 -3.61 1019.68 9.48 562.69 -3.06;
30.4 42.75 18.05 10.14 4.09 1012.77 -6.73 564.58 1.02;
54.8 74.38 35.21 7. -2.13 1018.4 5.39 562.79 -0.86;
20.45 19.82 21.09 5.75 -1.34 1023.01 5.41 564.7 3.03;
13.65 14.54 12.75 8.57 2.91 1026.29 3.97 572.03 8.43;
13.45 16.27 10.64 12.79 4.17 1020.4 -5.73 573.96 2.22;
12.89 14.84 10.94 16.32 3.44 1013.4 -7.1 574.01 0.1;
27.14 36.41 17.86 17.6 0.79 1008.32 -4.46 569.42 -4.64;
36.43 47.42 25.44 19.17 0.71 1003.48 -3.28 570.97 2.02;
52.92 61.78 44.07 18.54 -1.14 999.55 -3.09 570.51 -0.05;
63.27 62.13 64.41 9.76 -10.62 1009.7 12.03 565.42 -5.33;
33.82 31.33 36.31 11.66 2.15 1012.05 2.64 566.65 1.95;
42.49 40.11 44.88 11.41 -0.06 1014.13 1.76 568.26 1.92;
48.66 66.79 30.54 13.22 1.65 1011.99 -2.42 568.48 -0.31;
65.08 80.83 49.34 10.41 -2.3 1013.94 1.2 565.55 -2.84;
45.77 58.94 32.59 13.64 3.39 1013.91 -0.23 569.18 3.57;
41.52 48.78 34.27 13.07 -0.64 1017.23 3.5 571.54 2.97;
27.99 33.2 22.77 16.7 3.15 1018.14 1.49 578.72 7.18;
16.79 20.33 13.26 19.9 2.69 1012.12 -5.63 578.61 -0.49;
17.0 22.02 11.98 22.49 2.1 1011.55 0.58 583.16 5.52;
10.93 12.35 9.51 24.77 1.74 1004.67 -5.7 580.34 -2.03;
16.61 20.85 12.37 25.75 0.53 997.27 -7.04 575.04 -5.53;
23.86 30.66 17.07 25.21 -1.0 997.39 0.04 574.7 -0.56;
64.74 73.82 55.65 18.15 -7.6 1004.27 6.83 574.05 -1.17;
71.98 77.36 66.59 11.85 -7.52 1009.79 5.82 569.88 -4.43;
49.16 56.87 41.44 15.14 3.08 1011.94 3.08 572.45 3.73;
51.38 66.29 36.46 17.69 1.39 1011.64 0.27 576.9 4.34;
56.75 75.12 38.38 16.29 -1.66 1009.21 -1.98 571.46 -4.79;
60.35 75.95 44.75 14.79 -0.65 1009.71 -0.48 569.72 -1.42;
39.12 50.69 27.55 15.67 1.17 1010.71 0.57 570.66 1.54;
30.39 39.53 21.25 17.3 2.41 1014.53 3.13 576.23 6.01;
18.95 23.86 14.04 19.27 1.71 1013.16 -1.55 579.1 2.6;
18.31 22.77 13.85 22.95 3.9 1004.6 -8.44 578.19 0.0;
55.18 65.95 44.42 17.61 -5.68 1006.84 2.45 573.29 -4.59;
41.33 48.98 33.69 16.01 -3.01 1011.45 5.28 572.85 -0.19;
26.27 34.09 18.44 14.35 -1.75 1014.39 2.59 569.91 -3.05;
18.0 22.68 13.32 15.25 1.68 1019.32 4.97 577.61 8.63;
33.49 38.95 28.04 16.02 1.1 1015.5 -3.86 577.68 2.13;
18.26 20.25 16.27 20.1 3.59 1012.11 -3.5 580.13 2.73;
14.6 16.88 12.32 23.37 2.94 1006.96 -4.8 580.76 0.55;
36.87 48.63 25.11 22.14 -1.79 1008.39 0.94 580.41 -1.02;
36.35 46.29 26.42 22.09 1.04 1006.7 -2.58 578.77 -1.33;
24.98 27.91 22.05 22.65 0.99 1006.1 -1.48 579.42 0.55;
36.25 41.21 31.28 20.8 -1.22 1006.78 0.66 578.44 -0.04;
41.55 49.49 33.61 19.41 -2.02 1009.63 3.73 578.51 0.5;
43.73 55.1 32.35 19.71 -0.84 1009.92 0.55 577.43 -1.44;
34.5 41.24 27.75 20.52 -0.84 1007. -1.88 576.18 -2.06;
22.62 29.56 15.69 24.66 2.81 1002.24 -3.79 579.51 2.41;
43.59 55.5 31.69 22.33 -2.63 1005.66 3.79 579.82 0.51;
48.36 59.53 37.2 19.39 -3.59 1006.95 1.2 576.41 -3.42;
37.65 47.8 27.51 21.59 1.35 1005.01 -1.87 577.1 0.87;
26.73 34.2 19.26 24.64 3.8 1001.33 -4.9 578.85 1.0;
28.84 37.7 19.99 26.4 1.01 997.02 -3.68 577.05 -2.0;
24.81 31.7 17.92 26.66 -.35 996.7 0.13 576.92 -0.21;
43.66 57.31 30.0 23.42 -3.9 1000.54 3.99 575.99 -1.16;
26.25 34.69 17.8 26.09 1.44 997.89 -1.26 576.64 0.71;
25.34 32.75 17.94 26.82 1.02 994.86 -3.02 575.69 -0.4;
50.88 46.61 55.15 17.36 -9.57 1003.9 8.96 574.8 -1.42;
43.63 54.04 33.22 20.53 3.42 1003.22 -1.84 575.12 -0.19;
27.11 34.68 19.55 198.29 1022.3 1001.84 -1.24 575.76 1.02;
50.98 67.99 33.97 21.22 -1.35 1005.45 3.07 577.18 1.67;
64.65 76.02 53.27 16.83 -2.31 1009.54 2.11 575.49 -0.87;
34.5 42.32 26.68 22.38 5.11 1004.68 -5.2 578.5 2.92;
33.93 41.86 26.0 24.95 2.78 1001.53 -2.9 579.68 2.22;
53.36 70.89 35.83 23.04 -2.54 1002.62 1.88 578.88 -0.45
]';
t=[2.0 -5.6;
-1.8 -8.5;
-1.1 -7.9;
0.5 -5.9;
3.6 -2.2;
4.6 -1.9;
5.3 -2.7;
0.1 -2.8;
-0.1 -4.0;
1.5 -3.9;
3.2 -3.8;
1.3 -2.3;
2.3 -1.2;
0.3 -1.3;
0.6 -2.7;
-2.8 -4.0;
1.6 -3.2;
0.0 -0.4;
1.1 -1.0;
2.6 -0.9;
4.4 -0.8;
5.6 -0.2;
11.6 0.7;
12.6 1.3;
-1.5 -1.7;
-0.5 -4.7;
2.1 -3.7;
2.1 -3.5;
4.9 0.0;
13.4 3.1;
13.0 3.6;
17.7 5.3;
17.8 11.6;
17.2 9.4;
14.2 7.5;
17.8 6.5;
18.8 14.5;
12.4 7.8;
6.1 5.3;
10.3 4.2;
10.4 5.0;
11.2 4.0;
17.8 4.6;
19.2 7.8;
22.2 10.2;
26.4 12.2;
24.9 17.4;
24.8 14.0;
18.4 15.5;
10.6 7.5;
14.0 5.4;
18.1 8.1;
18.4 10.9;
17.5 10.8;
27.8 12.3;
23.8 15.8;
9.8 9.4;
6.8 4.2;
10.9 3.6;
10.5 6.1;
11.7 5.3;
14.8 4.5;
18.4 6.6;
21.4 9.7;
23.9 12.7;
26.4 13.8;
21.9 16.0;
9.6 9.5;
15.0 7.8;
12.0 11.4;
12.7 8.4;
13.8 9.2;
18.2 9.9;
22.1 11.4;
24.2 11.4;
26.9 20.7;
28.9 16.3;
31.9 24.7;
30.2 19.2;
30.7 23.0;
21.0 19.0;
15.9 10.7;
21.7 13.3;
20.9 15.4;
18.6 14.8;
17.8 10.8;
19.4 12.4;
23.2 13.7;
24.8 16.5;
29.4 21.5;
21.5 18.4;
22.2 15.8;
20.5 12.0;
21.7 11.7;
24.5 15.2;
26.8 21.0;
32.1 24.1;
23.6 18.8;
20.4 15.6;
16.7 15.3;
20.9 14.6;
18.1 14.2;
27.1 15.9;
27.2 18.3;
31.1 18.0;
24.4 19.3;
23.6 15.7;
27.7 17.3;
29.9 19.2;
32.5 20.5;
31.5 23.2;
29.4 23.6;
31.3 21.9;
32.6 22.7;
19.5 16.0;
21.6 15.6;
27.0 16.4;
15.2 15.2;
24.4 14.5;
28.5 16.5;
32.1 19.9;
30.6 22.4
]';
%%%%%归一化P
for i=1:9
% if
P(i,:)=(p(i,:)-min(p(i,:)))/(max(p(i,:))-min(p(i,:)));
%P(i,:)=(p(i,:)-(min(p(i,:)))*0.8)/((max(p(i,:))*1.2)-(min(p(i,:)))*0.8);
end
%%%%%归一化T
for i=1:2
T(i,:)=((t(i,:))-min(t(i,:)))/(max(t(i,:))-min(t(i,:)));
%T(i,:)=(t(i,:)-(min(t(i,:))*0.8))/((max(t(i,:))*1.2)-(min(t(i,:)))*0.8);
end
threshold=;
net=newelm(threshold,,{'tansig','logsig'},'trainlm');
net.trainParam.epochs=3000;
net.trainParam.goal=0.001;
net=init(net);
net=train(net,P,T);
p_test=[23.21 16.18 30.25 -2.85 1.05 1043.61 6.58 568.37 12.96;
20.44 10.88 30.0 0.35 3.13 1035.91 -7.94 568.59 0.27;
26.13 25.41 26.86 1.55 1.12 1028.01 -7.43 564.81 -4.09;
25.77 20.29 31.25 3.64 1.95 1023.95 -4.61 567.27 2.07;
31.06 26.35 35.76 4.51 1.23 1023.24 -2.04 567.36 -0.49;
39.49 39.58 39.41 6.57 2.32 1015.56 -8.33 563.63 -4.01;
47.13 52.95 41.31 7.74 1.34 1014.89 -1.0 563.35 -0.31;
37.91 35.68 40.13 3.63 -4.01 1017.82 2.62 560.44 -2.61;
42.33 51.38 33.29 3.86 0.49 1018.99 0.94 561.31 1.11]';
for i=1:9
P_test=(p_test(i,:)-min(p_test(i,:)))/(max(p_test(i,:))-min(p_test(i,:)));
end
y=sim(net,p_test);
??? Error using ==> network.sim
Inputs are incorrectly sized for network.
Matrix must have 9 rows.
Error in ==> shiyan at 279
Y=sim(net,P_test);
应该是有结果的,训练程序没什么问题,可为什么总是出现这个错误呢?
不出现结果没办法,帮我想想办法啊,各位大哥!`
[ 本帖最后由 ericlin 于 2006-8-10 16:51 编辑 ]
我试了没问题啊
threshold=;net=newelm(threshold,,{'tansig','logsig'},'trainlm');
net.trainParam.epochs=3000;
net.trainParam.goal=0.001;
net=init(net);
net=train(net,P,T);
TRAINLM, Epoch 0/3000, MSE 0.178062/0.001, Gradient 7.97719/1e-010
TRAINLM, Epoch 25/3000, MSE 0.00263865/0.001, Gradient 0.809432/1e-010
TRAINLM, Epoch 50/3000, MSE 0.00149296/0.001, Gradient 0.0674081/1e-010
TRAINLM, Epoch 70/3000, MSE 0.000978002/0.001, Gradient 0.965983/1e-010
TRAINLM, Performance goal met.
y=sim(net,p_test);
>> y
y =
0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002
0.9926 0.9926 0.9926 0.9926 0.9926 0.9926 0.9926 0.9926 0.9926 threshold=;
net=newelm(threshold,,{'tansig','logsig'},'trainlm');
net.trainParam.epochs=3000;
net.trainParam.goal=0.001;
net=init(net);
net=train(net,P,T);
p_test=[23.21 16.18 30.25 -2.85 1.05 1043.61 6.58 568.37 12.96;
20.44 10.88 30.0 0.35 3.13 1035.91 -7.94 568.59 0.27;
26.13 25.41 26.86 1.55 1.12 1028.01 -7.43 564.81 -4.09;
25.77 20.29 31.25 3.64 1.95 1023.95 -4.61 567.27 2.07;
31.06 26.35 35.76 4.51 1.23 1023.24 -2.04 567.36 -0.49;
39.49 39.58 39.41 6.57 2.32 1015.56 -8.33 563.63 -4.01;
47.13 52.95 41.31 7.74 1.34 1014.89 -1.0 563.35 -0.31;
37.91 35.68 40.13 3.63 -4.01 1017.82 2.62 560.44 -2.61;
42.33 51.38 33.29 3.86 0.49 1018.99 0.94 561.31 1.11]';
for i=1:9
P_test=(p_test(i,:)-min(p_test(i,:)))/(max(p_test(i,:))-min(p_test(i,:)));
end
y=sim(net,p_test);
P_test=(p_test(i,:)-min(p_test(i,:)))/(max(p_test(i,:))-min(p_test(i,:)));
应该是 P_test(i,:)=(p_test(i,:)-min(p_test(i,:)))/(max(p_test(i,:))-min(p_test(i,:)));
问题就解决了 谢谢两位大人!~!~真是强啊!~佩服佩服
页:
[1]