Self Mapping Organization code tutorial for beginners

6 vues (au cours des 30 derniers jours)
eanass abouzeid
eanass abouzeid le 15 Juil 2016
Commenté : eanass abouzeid le 15 Juil 2016
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 commentaires
John D'Errico
John D'Errico le 15 Juil 2016
So, you want a tutorial and explanation of your own code, code written by you?
eanass abouzeid
eanass abouzeid le 15 Juil 2016
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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by