0

如何获得包含 SOM 中神经元连接的 n×2 向量?例如,如果我有一个简单的 2x2 hextop SOM,则连接向量应如下所示:

[ 1 2 1 3 1 4 ]

这个向量表示神经元 1 连接到神经元 2,神经元 1 连接到神经元 3,等等。

如何从任何给定的 SOM 中检索此连接向量?

4

1 回答 1

1

假设 SOM 定义为邻域距离 1(即,对于每个神经元,边缘到欧几里得距离 1 内的所有神经元),Matlabshextop(...)命令的默认选项,您可以创建连接向量,如下所示:

pos = hextop(2,2);

% Find neurons within a Euclidean distance of 1, for each neuron.

% option A: count edges only 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)

上面的输出如下:

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

如果您有一个具有非默认邻域距离 ( != 1) 的 SOM,例如nDist,只需将find(..)上面的命令替换为

... find(distMat > 0 & distMat <= nDist);
于 2016-02-06T00:23:53.537 回答