We worry about one step iteration, because it will be associated to a Forever button, but it will stop automatically after Training-Time steps (a global variable from the interface): to SOM This algorithm is directly coded in NetLogo. Repeat from step 2 (the number of iterations deemed necessary). This radius will start with a big value (to cover all the network) and it will decrease in every iteration of the algorithm.Įvery node from BMU neighbourhood adjust its weight to get closer to \(V\), but in such way that closer nodes to BMU are stronger modified. For that, we simply compute the distances between all the weight vectors of all the learning nodes and \(V\) (by efficiency reasons, we will not apply the square root, because we only need to know where the minimum is).Ĭompute the radius of the BMU neighbourhood. The node with the most similar weight to \(V\), we will denote it as Best Matching Unit (BMU). Usually, a vector from \(^n\),Ī vector from the input data is selected, \(V\). In a more detailed form, the steps to follow in the training process are:Įvery node is initialized with a (random) weight. Create a random list of random RGB-colors Set pcolor scale-color black ((pxcor + pycor + 2 * max-pxcor) / (4 * max-pxcor)) 0 1
[ Associate a gradient grey vector to every patch
Set pcolor rgb (255 * item 0 weight) (255 * item 1 weight) (255 * item 2 weight) ]
[ Associate a random vector to every patch It can be done randomly, or using a grey gradient, by means of the Init chooser control in the interface. The Setup procedure initially assigns a weight to every node. Once the network stabilizes, any new vector will stimulate the area with similar weights. Every one of this stabilized areas becomes a properties classifier. In this way, starting from a initical distribution of weights (usually, a random one), SOM network tends to approximate a stable weights distribution. Roughly, since there is no goal vector to approximate, what we will do is, where the nodes of the of the network have weight vectors coincident with original vector, the surrounding learning nodes tend to approximate their respective weights to the same value. The training vectors will be stored in a global variable: TSet stores the Training Set
In our first NetLogo implementation we will make use of patches as training nodes, and we will store in a custom variable the weights of the connections with the 3 input nodes (3D, RGB colors). In this way, if the input layer has size \(n\) (the dimension of the original space), then every weight vector, \(W\), will have dimension \(n\). In fact, as we don't mind the geometrical or topological representation of input nodes, it is usual to work only with the representation of learning nodes, and hence the weights are shown as vectors in these nodes (every element in this vector is the weight of the connection with the correspondent input node). As in other similar models, the idea of the algorithm is to find correct weights for the connections between to give a correct representation of the input data in the geometrical structure of learning nodes. Next figure shows a possible 2D architecture for a SOM training. Also, there exist connections between all the nodes of both layers. SOM algorithm has a 2 layer network architecture: we have a learning nodes layer, which we mind the geometrical-topological relation between them, and that finally will contain the information about the resulting representation and we have one more layer with the input nodes, where the original vectors will be feeded to the network during the training process. From a technical point of view, it considers a network of nodes in a similar way as artificial neural networks.
In the obtained 2D representation, similar colors are located in adjacent regions.Īs machine learning algorithm, SOM is in the smaller bag of unsupervised methods, what means we have no feedback about a goal to require, but it provides a distribution of the vectors considering their similarities. Next figure show a trained SOM to recognize the 8 colors from the left. One important fact in Kohonen technique is that we also obtain some conservation of topological properties from the original data.Ī tipical example to see SOM working is based in the projection of colors (associated to 3D vectors from, for example, the RGB components) to a 2D space. In general, different techniques to reduce vectors dimensionality are data compression techniques also known as Vector Quantization. Self Organizing Maps, or SOM, were created in 1982 by Teuvo Kohonen, professor from the Finland Academy, and provide a way to represent multidimensional data (vectors) in lower dimensional spaces, usually 2D.