The applet implements simple neural network architecture with one layer and without hidden layers to recognition of input image pattern. This simplified network is sufficient enough to recognition for three patterns. When more patterns have to be recognized it may be necessary to introduce extra hidden layers. The applet operates on binary patters. Each graphical pattern area is represented with one-column matrix. That matrix representation is achieved by joining all rows of graphical input pattern. Shadowed ("on") pixels in graphical pattern correspond to numerical value of 1 in created matrix. Unshadowed ("off") pixels correspond to -1. The transformation is performed for all three target patterns that were used in the program so the resulting object is matrix P with three columns. Each column corresponds to one graphical pattern. In algorithm described here the order of columns of matrix P hasn't affect the response pattern of the network.


Next, the weights of the network are calculated by multiplying matrix P by its transposition. The resulting weight matrix is always square and its size depends on pattern size. For example, when the pattern dimensions are 5 by 7 pixels the dimensions of weight matrix are 35 by 35.


The input pattern is also transformed from its graphical representation into matrix representation in the same way the target patterns have been transformed. In the program it is possible to give the input pattern with four gray levels so you can treat the input pattern as nearly analog image. The numerical representation of the gray levels is: -3, -1, 1 and 3;


The next step is to calculate the response pattern of the network that comes from the given input pattern. The answer matrix A is made by multiplying weight matrix by input matrix I. It means that each row of weight matrix W represents separate neuron and what's more consecutive elements of the row represents consecutive synaptic connections of that neuron.


The obtained answer matrix is bringing back into graphical representation. The matrix has to be binarized before it can be painted on the screen. During binarization process the elements in the matrix A that are positive are shown on the screen in the form of "lighted" ("on") pixels and negative elements in the matrix are shown as "off" pixels.