# 81.

 C++ Neural Networks and Fuzzy Logic by Valluru B. Rao M&T Books, IDG Books Worldwide, Inc. ISBN: 1558515526   Pub Date: 06/01/95

#### Orthogonal Input Vectors Example

For a second example, look at Figure 11.5, where we choose input vectors on a two-dimensional unit circle that are 90° apart. The input.dat file should look like the following:

`  1  0  0  1 -1  0  0 -1 `

Figure 11.5  Orthogonal input vectors.

Using the same parameters for the Kohonen network, but with layer sizes of 2 and 10, what result would you expect? The output file, kohonen.dat, follows:

` cycle     pattern     win index    neigh_size      avg_dist_per_pattern ——————————————————————————————————————————————————————————————————————— 0         0           4            5               100.000000 0         1           0            5               100.000000 0         2           9            5               100.000000 0         3           3            5               100.000000 1         4           4            5               0.444558 1         5           0            5               0.444558 497       1991        6            0               0.707107 498       1992        0            0               0.707107 498       1993        0            0               0.707107 498       1994        6            0               0.707107 498       1995        6            0               0.707107 499       1996        0            0               0.707107 499       1997        0            0               0.707107 499       1998        6            0               0.707107 499       1999        6            0               0.707107 `

You can see that this example doesn’t quite work. Even though the neighborhood size gradually got reduced to zero, the four inputs did not get categorized to different outputs. The winner distance became stuck at the value of 0.707, which is the distance from a vector at 45°. In other words, the map generalizes a little too much, arriving at the middle value for all of the input vectors.

You can fix this problem by starting with a smaller neighborhood size, which provides for less generalization. By using the same parameters and a neighborhood size of 2, the following output is obtained.

` cycle     pattern     win index    neigh_size    avg_dist_per_pattern ————————————————————————————————————————————————————————————————————— 0         0           5            2             100.000000 0         1           6            2             100.000000 0         2           4            2             100.000000 0         3           9            2             100.000000 1         4           0            2             0.431695 1         5           6            2             0.431695 1         6           3            2             0.431695 1         7           9            2             0.431695 2         8           0            2             0.504728 2         9           6            2             0.504728 2         10          3            2             0.504728 2         11          9            2             0.504728 3         12          0            2             0.353309 3         13          6            2             0.353309 3         14          3            2             0.353309 3         15          9            2             0.353309 4         16          0            2             0.247317 4         17          6            2             0.247317 4         18          3            2             0.247317 4         19          9            2             0.247317 5         20          0            2             0.173122 5         21          6            2             0.173122 5         22          3            2             0.173122 5         23          9            2             0.173122 6         24          0            2             0.121185 6         25          6            2             0.121185 6         26          3            2             0.121185 6         27          9            2             0.121185 7         28          0            2             0.084830 7         29          6            2             0.084830 7         30          3            2             0.084830 7         31          9            2             0.084830 8         32          0            2             0.059381 8         33          6            2             0.059381 8         34          3            2             0.059381 8         35          9            2             0.059381 `

For this case, the network quickly converges on a unique winner for each of the four input patterns, and the distance criterion is below the set criterion within eight cycles. You can experiment with other input data sets and combinations of Kohonen network parameters.