【问题标题】:Get hextop self-organizing map neuron connections获取 hextop 自组织映射神经元连接
【发布时间】:2016-02-06 08:23:53
【问题描述】:
如何获得一个包含 SOM 中神经元连接的 n×2 向量?例如,如果我有一个简单的 2x2 hextop SOM,则连接向量应如下所示:
[
1 2
1 3
1 4
]
这个向量表示神经元 1 连接到神经元 2,神经元 1 连接到神经元 3,等等。
如何从任何给定的 SOM 中检索此连接向量?
【问题讨论】:
-
我对@987654321@ 不是很熟悉,我假设你正在使用它,但是看看plotsomnc 的代码,sparse(tril(net.layers{1}.distances <= 1.001)-eye(net.layers{1}.size)) 会给你想要的吗?否则,如果您提供了一个关于如何设置 SOM 网络的基本可运行示例,将会对我们有所帮助。
标签:
matlab
neural-network
self-organizing-maps
【解决方案1】:
假设 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
如果您的 SOM 具有非默认邻域距离 (!= 1),例如 nDist,只需将上面的 find(..) 命令替换为
... find(distMat > 0 & distMat <= nDist);