How can the Neighbourhood function of a Self Organizing map be estimated?

조회 수: 4 (최근 30일)
Ijeoma Madu
Ijeoma Madu 2013년 1월 9일
Happy new year :) I would like to write a code for a self organizing map without using the matlab inbuilt SOM function. How can i estimate the neighbourhood function.
h=alpha.*exp(-((ri-rc).^2)/2.*(width).^2);
ri and rc are the vectorial location on the display grid. Alpha and width decreases monotonically with the regression steps. My questions are how do i compute ri, rc and the width so as to get the neighbourhood function?
Any ideas will be appreciated!
x1=signal(1);
x2=signal(2);
x3=signal(3);
x4=signal(4);
x=[x1;x2;x3;x4];
alpha=0.01;
width=2;%%%may be
w=zeros(1,length(x1));
D = sqrt(sum((x1-w).^2));%%%Euclidean Distance
c=min(D);
while max(max(abs(delw)))> 0.00001
for j=1:4
h=alpha.*exp(-((ri-rc).^2)/2.*(width).^2);
deltaw=(h.*(x(:,j)-w));
w=w+delw;
end
alpha=alpha*0.9;
width=width.*0.9;
D = sqrt(sum((x(:,j)-w).^2));%%%Euclidean Distance
c=min(D);
end
This is the idea i have on the SOM script but i am very unssure if it makes any sense. Suggestions please

답변 (1개)

Thorsten
Thorsten 2013년 1월 9일
편집: Thorsten 2013년 1월 9일
width = 2; % == sigma of Gaussian neighboring function
% change to select size of neighborhood that is about 3 x sigma
b = ceil(3*width); % 99.8% of the Gaussin is in [-3*sigma, 3*sigma];
% BTW: 99.8% is normcdf(3) or 0.5*erfc(-3/sqrt(2))
x = -b:b; y = x; [X Y] = meshgrid(x, y);
G = 1/(2*pi*width^2)*exp(-(X.^2+Y.^2)/(2*width^2)); % 2D Gaussian
G = G/sum(G(:)); % normalize
I = rand(100); % sample input
R = conv2(I, G); % input weighted by neighboring function
subplot(1,3,1), surfl(x, y, G), title('Gaussian neighboring function G')
axis square
subplot(1,3,2), imshow(I, []), title('Input')
subplot(1,3,3), imshow(R, []), title('Input weighted by G')
  댓글 수: 1
Ijeoma Madu
Ijeoma Madu 2013년 1월 11일
Thanks but why is y=x? How can i interprete the neighbourhood function you used above with the one below
h=alpha.*exp(-((ri-rc).^2)/2.*(width).^2);
ri and rc are the vector of the coordinates of cells c and i.

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

카테고리

Help CenterFile Exchange에서 Live Scripts and Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by