📄 li.m
字号:
%exercise2
%
P=[0 0 1 1;0 1 0 1];
T1=[0 0 1 0;0 1 0 0];
T2=[0 1 1 0];
[R,Q]=size(P);
[S1,Q]=size(T1);
S2=size(T2,1);
[W10,B10]=rand(S1,R)
[W20,B20]=rand(S2,S1);
net1=newp(minmax(P),S1);
net1.iw{1,1}=W10;
net1.b{1}=B10;
A10=sim(net1,P);
net1.trainParam.epochs=20;
net1=train(net1,P,T1);
W1=net1.iw{1,1}
B1=net1.b{1}
A1=sim(net,P);
net2=newp(minmax(A1),S2);
net2.iw{1,1}=W20;
net2.b{1)=B20;
A20=sim(net2,A1);
net2=train(net2,A1,T2);
W2=net2.iw{1,1};
B2=net2.b{1};
A2=sim(net2,A1);
W10,W1,B10,B1,W20,W2,B20,B2;
%化分类图
figure(2);
V=[-2 2 -2 2];
plotpv(P,T2,V);
pause
hold on
xlable('P1');
ylabel('P2');
plotpc(W10,B10);
figure(3);
V=[-2 2 -2 2];
plotpv(P,T2,V);
hold on
xlable('P1');
ylabel('P2');
plotpc(W1,B1);
hold off
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -