The Kohonen Self-Organising MapThis architecture was pioneered by Professor Teuvo Kohonen at the University of Helsinki. It is unlike the other architectures that we have met before as it involves unsupervised training. It learns the patterns for itself without being told what it is supposed to be learning! In supervised learning, which is what we have been using up to now, we train the networks by presenting them with an input pattern together with a corresponding output pattern, and the networks adjust their connections so as to learn the relationship. However, with the Self-Organising Map (SOM), we just give it a series of input patterns, and it learns for itself how to group these together so that similar patterns produce similar outputs. It's about time that we saw for ourselves what the SOM looks like .... Well, that's the Kohonen SOM on the right. It consists of a single layer of cells, all of which are connected to a series of inputs. The inputs themselves are not cells and do no processing - they are just the points where the input signal enters the system. The cells in the diagram appear to have connections between them (and indeed, descriptions of Kohonen nets I have read generally refer to "lateral inhibitory connections"), but the algorithm for training the net never mentions them, and so, I shan't refer to them again! Training the Kohonen SOMThe SOM is generally speaking a two-dimensional structure - a rectangular grid of cells - which allows "blobs" of activity to appear on its surface and represent groupings. If it were three dimensions or more, then it would be hard for anyone to visualise the patterns of activity. However, for the purposes of describing the training algorithm, I shall use a one-dimensional example. The idea behind the training is that the weights (strengths of connections between the inputs and each of the nodes in the grid) are set to random values. Then the patterns are presented one after each other. Each pattern is "run forward" in the net, so that the net produces an output. Although the weights are random, one of the nodes has to produce a slightly higher output than the others, and that node is chosen as the "winner." The weights of the winning node and those in its immediate neighbourhood are updated slightly so that they are more likely to correspond to the input pattern in future. In this way, groups of nodes across the SOM become dedicated to classes of input pattern and those similar to them.
Running the Kohonen SOMThis part I have never seen in any literature about SOMs - not once. Nobody seems to write about it, so I have had to work out the rule for myself. However, it does seem to work. To calculate the output for each cell, just apply the required input to all the nodes. Then, for each cell in the grid, multiply corresponding inputs and weights, and sum the values, and that is the output for that node. There doesn't seem to be any need for a transfer function. for (var j = 0; j < NUMCELLS; j++) { var sum = 0.0; for (var i = 0; i < n; i++) sum += w[i][j] * x[i]; // Weight times input alert('Output for cell ' + j + ' : ' + sum); } We can't guarantee that the output of the cells will be in the range 0.0 to 1.0. It may be above 1.0, so there may be occasions where you have to impose a ceiling on it. In the example below, I artificially impose a ceiling of 1.0 so that the pictures are displayed correctly. An example of a Kohonen SOMThis example shows a JavaScript version of the one-dimensional SOM that I have just described. It has 10 output cells and two inputs. During training, the program is designed to present two types of input to the SOM, either the first input high (in the range 0.8 to 1.0) and the second low (0.0 to 0.2) or vice-versa.
The way you use the program is as follows: Firstly (without training the net), try a few values in the range 0 to 1 in the two input slots on the left. You should find that the network doesn't give much of a response, since the weights are initially very low. Then click on the Train button, and repeat the testing process. You should find that you get well defined islands of activity when the first input is high (0.8 to 1.0) and the second low (0 to 0.2) or vice-versa. A two-dimensional Kohonen SOMThe Kohonen SOM really comes into its own with a two-dimensional grid of cells. The example I have included below is similar to the one dimensional example except that all the variables have been given the suffix '2' to distinguish them from the variables in the one-dimensional example. For instance, the weights are stored in the array w2. However, the input still uses the array x. This time the input consists of four groups of numbers: Low-low, Low-high, High-low and High-high, created in the same manner as before. We should find that four large "islands" of activation form in the grid, although we can't predict exactly where.
|