Self Mapping Organization code tutorial for beginners

조회 수: 15 (최근 30일)
eanass abouzeid
eanass abouzeid 2016년 7월 15일
댓글: eanass abouzeid 2016년 7월 15일
i have tried many of posted codes, but i cannot understand well because no comments in the code to describe which step of the SOM it is doing.
as i have a problem understanding when and how do i update the weights of the neighbors.
i made my own code, it depends on linear form not a mesh as following:
%
function [som2]= som_horizontal(x,path)
%x = when it is in the whole hmm prog, is equal the feature matrex generated from all the frames
%path : in the hmm prog, i used the path to load the weight matrix i
%generated for each gesture when i ran the prog on each gesture for the
%first time, so that i have fixed clustering and be sure it wont change
%with diff random weight generated.
%clc
d=[];
eta=[];
som2=[]
eta(1)=0.5;
dii=0;
x=[1 1 0 0 ;0 0 0 1;1 0 0 0 ;0 0 1 1];%;1 0 0 0 1;0 0 1 1 0]; %feature vectors
N=size(x,2);
m=2; % number of output nodes, when it is >2 clustering change with each run .
ww = rand(N,m) %using random weight makes output change between 2 1 2 1 & 1 2 1 2
% using the next weight instead of random , as example says, give the fixed
% output.
%ww=[0.2 0.8;0.6 0.4;0.5 0.7;0.9 0.3];%;0.3 0.5;0.8 0.6]; % waits for each vector and cluster
R=0; %radius is zero , linear
%ww=w.'
wwn=ww;
time=1;
t=1;
k=1;
for iteration=1:100
for n=1:size(x,1)
if t<=N
eta(t)=0.6;
else
%eta(t)=0.3;%
eta(t)=0.5 * eta(k-N); % this is according to the example i have used to apply the code
% from the following presentation https://genome.tugraz.at/MedicalInformatics2/SOM.pdf
end
for j=1:m
for i=1:N %size(x,2)
x(n,i); %just to read and check the values
wwn(i,j);
d(i)=((ww(i,j)- x(n,i)).^2); %distance calculation for each weight
dii=d(i)+dii;
end
di(j)=dii;
dii=0;
end
[v,indx]=min(di);
for i=1:N %size(x,2)
ww(i,indx);
x(n,i);
%update the weights
wwn(i,indx)=((1-eta(t))*ww(i,indx))+(eta(t)*x(n,i));
end
ww=wwn;
time=time+1;
t=t+1;
somo(n)=indx;
end
som2=somo(1,:) ;
k=k+N;
iteration;
eta;
ww;
end
end
  댓글 수: 3
John D'Errico
John D'Errico 2016년 7월 15일
So, you want a tutorial and explanation of your own code, code written by you?
eanass abouzeid
eanass abouzeid 2016년 7월 15일
no actualy the question is : i need a toturial code and a good referance to understand the SOM when the output nodes are in mesh topology. with Radius > zero
about the code, this is the code i wrote when the output nodes are not considering neighbors to update their weights. i.e when Radius = zero.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by