?? example4_2.m
字號:
%輸入樣本點及其相應(yīng)的類別,其中有一個奇異點
P=[-0.5 -0.5 0.3 -0.1 0.2 0.0 0.6 0.8 60;
-0.5 0.5 -0.5 1.0 0.5 -0.9 0.8 -0.6 20];
T=[1 1 0 1 1 0 1 0 1];
%在坐標圖上繪出樣本點
plotpv(P,T);
%建立一個感知器網(wǎng)絡(luò)
figure;
plotpv(P,T);
net=newp([-1 60;1 20],1);
handle=plotpc(net.iw{1},net.b{1});
%利用樣本點訓練網(wǎng)絡(luò)并繪出得到的分類線
E=1;
while (sse(E)),
[net,Y,E]=adapt(net,P,T);
handle=plotpc(net.iw{1},net.b{1},handle);
end;
%局部放大分類線圖
figure;
plotpv(P,T);
plotpc(net.iw{1},net.b{1});
axis([-2 2 -2 2]);
%選擇10個點來測試網(wǎng)絡(luò)
testpoints=[-0.5 0.3 -0.9 0.4 -0.1 0.2 -0.6 0.8 0.1 -0.4;
-0.3 -0.8 -0.4 -0.7 0.4 -0.6 0.1 -0.5 -0.5 0.3];
a=sim(net,testpoints);
%在坐標圖上繪出網(wǎng)絡(luò)的分類結(jié)果及分類線
figure;
plotpv(testpoints,a);
plotpc(net.iw{1},net.b{1});
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -