# KohTest - end e for epoch=1:500 for i=1:100...

This preview shows pages 1–2. Sign up to view the full content.

% %Kohonen Self Organizing Test % function [inds,success]= KohTest(Ts) f load ('E:\Program Files\MATLAB\R2006a\work\Neural Network\MiniProject3\nnp1.mat'); l Tsn=.1*Ts; %normalized test set T %since we know the cluster patterns we may choose the initial weights as %the cluster centers. That is: alfa0=.01; alfa=.7; tau=5; t Wk=zeros(10,100); S=y(1:100,:); Sn=.1*S; %normalized S k=1; ind=zeros(100,1); VNet=zeros(10,100); %To initailize weight matrix we are just trying to find the cluster center %of each pattern class. for i=1:10 for j=1:10 Wk(i,:)=Wk(i,:)+S(:,k)'; k=k+1; end end Wk=.1*Wk; % so we found the cluster center. a=1; %To normalize weight matrix. for i=1:10 Wk(i,:)=Wk(i,:)/norm(Wk(i,:));

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end e for epoch=1:500 for i=1:100 VNet(:,i)=Wk*S(:,i); [win(i,1),ind(i,1)]=max(VNet(:,i)); if(i==100) Wk(ind(i,1),:)=Wk(ind(i,1),:); else %ind(i+1,1)=ind(i,1)+1; %Updating weights Wk(ind(i,1),:)=Wk(ind(i,1),:)+(alfa0+alfa*exp(-epoch/tau))*(Sn(:,i)'-Wk(ind(i,1),:)); end Wk(ind(i,1),:)=Wk(ind(i,1),:)/norm(Wk(ind(i,1),:)); %Normalizing weights end end e for epoch=1:1000 for i=1:100 VNet(:,i)=Wk*Ts(:,i); [win(i,1),ind(i,1)]=max(VNet(:,i)); end end e winner=1; basari=0; for i=1:10 for j=1:10 if (ind(winner,1)==i) basari=basari+1; end winner=winner+1; end end e inds=ind; success=basari;...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

KohTest - end e for epoch=1:500 for i=1:100...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online