mapsselfsom

Self organizing maps


I have question regarding the self organizing maps algorithm

I know that we have an input vector and weight vectors. The calculation of the min distance between the weight and input is the best match unit which make the weight column that relates to the min value update and then update its neighbors.After that we update the rate (assuming you have an experience in SOM).

example

input 
i1: (1, 1, 0, 0)

weight =
[.8 .4 .7 .3
.2 .6 .5 .9]

learning rate .6

steps (simply and dropping Gaussian function)

first iteration.

1- find the min distance

 d2 = (.2-1)2 + (.6-1)2 + (.5-0)2 + (.9-0)2 = 1.86
 d2 = (.8-1)2 + (.4-1)2 + (.7-0)2 + (.3-0)2 = .98   this is the BMU

2- update weight vector

new−unit2−weights = [.8 .4 .7 .3] + 0.6([1 1 0 0]-[.8 .4 .7 .3]) 
                  = [.92 .76 .28 .12]

the result of the weight is

.8   .4  .7  .3
.92 .76 .28 .12

my questions

1- at the end, I'll be getting new weight vector values and the same input vectors.

what should be plotted? Weight or input or what?

If am using matlab do you have any idea what function to use to get good illustration


Solution

  • I am learning SOM algorithm these days, and I am going to use Python to implement the algorithm, if you are familiar with Python I think you can click this link, som_test.

    Your weight is

    weight =
    [.8 .4 .7 .3
    .2 .6 .5 .9]
    

    and you input value is

    vector = [1, 1, 0, 0]
    

    And I think the output layer is 2 because the initial weight is 2 by 4 matrix. And you can plot both the input data and the weight.

    The input value is

    [[0.1961, 0.9806],
    [-0.1961, 0.9806],
    [0.9806, 0.1961],
    [0.9806, -0.1961],
    [-0.5812, -0.8137],
    [-0.8137, -0.5812],]
    

    And the plot is, the weight is 3 by 2 matrix, as you can see in the image, there are 3 Xs, that are weights.

    plot