如何获得包含SOM中神经元连接的n-by-2矢量?例如,如果我有一个简单的2x2六头SOM,连接向量应该如下所示:
[ 1 2 1 3 1 4 ]
这个向量表示神经元1连接到神经元2,神经元1连接到神经元3,等等。
如何从给定的SOM中检索这个连接向量?
发布于 2016-02-06 00:23:53
假设SOM是用邻域距离1定义的(即,对于每个神经元,每个神经元在欧氏距离为1的范围内与所有神经元的边),那么Matlabs hextop(...)
命令的默认选项可以如下所示创建连接向量:
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);
https://stackoverflow.com/questions/35233381
复制相似问题