How can the Neighbourhood function of a Self Organizing map be estimated?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Thorsten
am 9 Jan. 2013
Bearbeitet: Thorsten
am 9 Jan. 2013
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')
Siehe auch
Kategorien
Mehr zu Live Scripts and Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!