帮忙看看什么原因总出错阿,急救阿
c=load('d:\c2.txt');a=load('d:\a2.txt');
c=c';
a=a';
n=0;
dsum=1;
v=abs(randn(3,6)); %输入层至隐含层连接权
z1=randn(3,1);%输入层阈值
z=zeros(3,5);
z(:,1)=z1;
z(:,2)=z1;
z(:,3)=z1;
z(:,4)=z1;
z(:,5)=z1;
s=zeros(3,5);
b=zeros(3,5);
%隐含层至输出层
w=abs(randn(2,3)); %隐含层至输出层连接权
zy1=randn(2,1);%隐含层阈值
zy(:,1)=zy1;
zy(:,2)=zy1;
zy(:,3)=zy1;
zy(:,4)=zy1;
zy(:,5)=zy1;
l=zeros(2,5);
cc=zeros(2,5);
con=;
d=zeros(2,5);
con2=;
SL1=randn(1,1);
SL2=randn(1,1);
while dsum>0.00001
s=v*a+z;
b=1./(1+exp(-s) );
%隐含层至输出层
l=w*b+zy;
cc=1./(1+exp(-l));
%计算误差
j=c-cc;
d=j.*c.*(con-c);
e=w'*d.*b.*(con2-b);
SL1=abs(randn(1,1));
SL2=abs(randn(1,1));
w=w+SL1*d*b';
zy=zy+SL1*d;
v=v+SL2*e*a';
z=z+SL2*e;
dsum=0;
for i=1:2
for j=1:5
dsum=dsum+abs(d(i,j));
end
end
n=n+1;
error(n)=dsum;
end
n1=1:n;
plot(n1,error)
错误信息:??? Error using ==> mtimes
Inner matrix dimensions must agree.
a2文件:
31
88
5
14
18
50
44
66
74
25
30
42
0
21
9
14
0
45
9
8
31
10
14
8
21
29
42
28
15
38
64
31
2
32
46
113
23
36
34
43
27
42
152
76
0
95
62
16
36
49
100
53
37
52
156
回复 楼主 swyh1105 的帖子
c2文件:527 24 0 13 6 41160 52 4 23 9 20
706 5 1 1 2 1
1760 12 0 10 1 1
2340 15 0 8 3 4
1110 28 0 8 6 14
732 34 4 11 6 16
537 39 8 16 7 15
522 37 2 17 3 16
880 20 3 13 0 7
654 21 0 9 2 9
1040 24 0 9 2 13
370 0 0 0 0 0
2220 17 4 4 1 12
980 6 0 0 0 6
285 11 6 6 0 5
184 0 0 0 0 0
1060 25 11 11 0 14
402 9 2 2 0 7
350 7 2 2 0 5
641 17 0 1 0 15
364 6 0 0 0 6
152 9 0 0 0 9
464 7 5 5 0 2
532 16 7 7 0 8
600 25 8 13 0 12
446 28 2 7 0 19
765 24 9 9 3 10
506 11 1 1 0 9
840 30 12 12 0 17
635 36 9 9 5 20
590 24 8 9 0 14
1050 2 0 0 0 2
838 21 0 8 0 12
1280 35 8 17 1 15
480 56 7 25 7 22
3200 15 1 1 3 11
2200 25 1 12 0 13
781 28 5 9 3 15
1640 32 8 11 2 17
578 20 1 7 1 12
643 34 8 11 3 18
652 72 19 26 7 27
220 45 8 17 2 20
1270 0 0 0 0 0
561 60 17 30 7 21
1620 47 18 25 4 17
770 12 0 1 0 11
717 26 7 9 2 15
972 39 12 12 3 21
104 61 15 26 4 24
694 40 14 14 3 21
742 32 10 12 4 16
344 29 2 7 0 18
948 88 17 33 9 25
回复 楼主 swyh1105 的帖子
矩阵维数不对,LZ再仔细检查一下
页:
[1]