matlab - Get hextop self-organizing map neuron connections -


how n-by-2 vector contains connections of neurons in som? example, if have simple 2x2 hextop som, connections vector should like:

[ 1 2 1 3 1 4 ]

this vector indicates neuron 1 connected neuron 2, neuron 1 connected neuron 3, etc.

how can connections vector retrieved given som?

assuming som defined neighbourhood distance 1 (i.e., each neuron, edges neurons within euclidian distance of 1), default option matlabs hextop(...) command, can create connections vector follows:

pos = hextop(2,2);  % find neurons within euclidean distance of 1, each neuron.  % option a: count edges once distmat = triu(dist(pos)); [i, j] = find(distmat > 0 & distmat <= 1); connectionsvectora = [i j]  % option b: count edges in both directions distmat = dist(pos); [i, j] = find(distmat > 0 & distmat <= 1); connectionsvectorb = sortrows([i j])  % verify graphically plotsom(pos) 

the output above follows:

connectionsvectora =       1     2      1     3      2     3      2     4      3     4   connectionsvectorb =       1     2      1     3      2     1      2     3      2     4      3     1      3     2      3     4      4     2      4     3 

if have som non-default neighbourhood distance (!= 1), ndist, replace find(..) commands above with

... find(distmat > 0 & distmat <= ndist); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -