Main Content

One-Dimensional Self-Organizing Map

Neurons in a 2-D layer learn to represent different regions of the input space where input vectors occur. In addition, neighboring neurons learn to respond to similar inputs, thus the layer learns the topology of the presented input space.

Here 100 data points are created on the unit circle.

A competitive network will be used to classify these points into natural classes.

angles = 0:0.5*pi/99:0.5*pi;
X = [sin(angles); cos(angles)];

Figure contains an axes object. The axes contains a line object which displays its values using only markers.

The map will be a 1-dimensional layer of 10 neurons.

net = selforgmap(10);

Specify that the network is to be trained for 10 epochs and use train to train the network on the input data.

net.trainParam.epochs = 10;
net = train(net,X);

Figure Neural Network Training (03-Mar-2023 09:05:57) contains an object of type uigridlayout.

Now plot the trained network's weight positions by using plotsompos.

The red dots are the neuron's weight vectors, and the blue lines connect each pair within a distance of 1.


Figure SOM Weight Positions (plotsompos) contains an axes object. The axes object with title SOM Weight Positions, xlabel Weight 1, ylabel Weight 2 contains 3 objects of type line. One or more of the lines displays its values using only markers

The map can now be used to classify inputs, such as [1; 0]. Either neuron 1 or 10 should have an output of 1, as the above input vector was at one end of the presented input space. The first pair of numbers indicate the neuron, and the single number indicates its output.

x = [1;0];
a = net(x)
a = 10×1