自组织神经网络的实现
生活随笔
收集整理的這篇文章主要介紹了
自组织神经网络的实现
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、可以調用MATLAB工具箱里的函數創建競爭性神經網絡: ?主要進行分類:
newc(p,s,KLR,CLR) ? --------------------------------------p表示輸入的范圍,
s-------------------------------表示神經元的個數 ? ? ? ? ? ? ? ?KLR表示Kohonen學習速率,-------------------------------CLR表示Conscience的學習速率
該網絡的訓練: <span style="font-size:18px;">p = [.1 .8 .1 .9; .2 .9 .1 .8]net = newc([0 1; 0 1],2);wts = net.IW{1,1}biases = net.b{1}net.trainFcnnet.trainParam.epochs = 500; net = train(net,p);a = sim(net,p) ac = vec2ind(a)</span>
2、自組織特征映射類型的神經網絡
net=newsom(p,[d1 d2 .....],tfcn,dfcn,steps,in)
p表示輸入向量,di表示第i層大小,,默認[5 8], tfcn表示網絡的拓撲結構,默認的是hextop, ? dfcn表示網絡的距離函數,默認的是linkdist
step表示調整階段的鄰域變為1的步驟,默認100, in表示初始網絡的大小,默認3
SOFM網絡的建立:
<span style="font-size:18px;">net = newsom([0 2; 0 1],[2 3]);P = [.1 .3 1.2 1.1 1.8 1.7 .1 .3 1.2 1.1 1.8 1.7;... 0.2 0.1 0.3 0.1 0.3 0.2 1.8 1.8 1.9 1.9 1.7 1.8]plot(P(1,:),P(2,:),'o','markersize',8) hold on plotsom(net.iw{1,1},net.layers{1}.distances) hold offnet.iw{1,1}</span> 網絡的訓練: <span style="font-size:18px;">net = newsom([0 2; 0 1],[2 3]);P = [.1 .3 1.2 1.1 1.8 1.7 .1 .3 1.2 1.1 1.8 1.7;... 0.2 0.1 0.3 0.1 0.3 0.2 1.8 1.8 1.9 1.9 1.7 1.8]plot(P(1,:),P(2,:),'o','markersize',8) hold on plotsom(net.iw{1,1},net.layers{1}.distances) hold offnet.iw{1,1}net.trainParam.epochs = 1000; net = train(net,P);plotsom(net.iw{1,1},net.layers{1}.distances)</span>LVQ神經網絡 ? ? ? ? ??
主要用于模式分類:
netnewlvq(pr,sl,pc,ir,if)
pr表示R*2的矩陣,代表輸入向量元素的最大值和最小值
s1表示隱含層的神經元數目;
pc為二元向量,表示典型的類別權重百分比;
ir表示學習速度
if學習函數
競爭性網絡的一個分類:
自組織特征映射網絡的實驗:
<span style="font-size:18px;">angles = 0:0.5*pi/99:0.5*pi; P = [sin(angles); cos(angles)]; plot(P(1,:),P(2,:),'+r')net = newsom([0 1;0 1],[10]);net.trainParam.epochs = 10; net = train(net,P);plotsom(net.iw{1,1},net.layers{1}.distances)p = [1;0]; a = sim(net,p) </span>
LVQ神經網絡的運用:分類: <span style="font-size:18px;">P = [-3 -2 -2 0 0 0 0 +2 +2 +3;0 +1 -1 +2 +1 -1 -2 +1 -1 0]; C = [1 1 1 2 2 2 2 1 1 1]; T = ind2vec(C);cla for i=1:10 if(C(i)==1) plot(P(1,i),P(2,i),'+') hold on; else plot(P(1,i),P(2,i),'o') hold on; end endnet = newlvq(minmax(P),4,[.6 .4],0.1);hold on W1 = net.IW{1}; plot(W1(1,1),W1(1,2),'*') title('Input/Weight Vectors'); xlabel('P(1), W(1)'); ylabel('P(2), W(3)');net.trainParam.epochs=150; net=train(net,P,T);W1 = net.IW{1}; W2 = vec2ind(net.IW{1});cla; for i=1:10 if(C(i)==1) plot(P(1,i),P(2,i),'+') hold on; else plot(P(1,i),P(2,i),'o') hold on; end end for i=1:4 if(W2(i)==1) plot(W1(i, 1),W1(i, 2),'*') hold on; else plot(W1(i, 1),W1(i, 2),'.') hold on; end endp = [0.2; 1]; a = vec2ind(sim(net,p)), </span>
總結
以上是生活随笔為你收集整理的自组织神经网络的实现的全部內容,希望文章能夠幫你解決所遇到的問題。