2016-02-05 65 views
0

如何獲得包含SOM中神經元連接的n乘2矢量?例如,如果我有一個簡單的2×2 hextop SOM,連接載體應是這樣的:獲取hextop自組織映射神經元連接

[ 1 2 1 3 1 4 ]

該向量指示所述神經元1被連接到神經元2,神經元1被連接到神經元3等。

如何從任何給定的SOM中檢索此連接向量?

+0

我不是很熟悉['selforgmap'(http://www.mathworks.com/help/nnet/ref/selforgmap.html),我以爲你是個命令使用,但看着['plotsomnc'](http://www.mathworks.com/help/nnet/ref/plotsomnc.html)的代碼,會稀疏(tril(net.layers {1} .distances < = 1.001)-eye(net.layers {1} .size))'給你想要的東西?否則,如果您提供了有關如何設置SOM網絡的基本可運行示例,它將對我們有所幫助。 – horchler

回答

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 

如果你有一個非默認附近距離(!= 1)一個SOM,說nDist,只需更換以上

... find(distMat > 0 & distMat <= nDist); 
+0

輝煌 - 謝謝! –

+0

@BrianGoodwin樂於助人。 – dfri