Neural Network Toolbox Previous page   Next Page

Creating a Competitive Neural Network (newc)

A competitive neural network can be created with the function newc. We show how this works with a simple example.

Suppose we want to divide the following four two-element vectors into two classes.

Thus, we have two vectors near the origin and two vectors near (1,1).

First, create a two-neuron layer with two input elements ranging from 0 to 1. The first argument gives the range of the two input vectors and the second argument says that there are to be two neurons.

The weights are initialized to the center of the input ranges with the function midpoint. We can check to see these initial values as follows:

These weights are indeed the values at the midpoint of the range (0 to 1) of the inputs, as we would expect when using midpoint for initialization.

The biases are computed by initcon, which gives

Now we have a network, but we need to train it to do the classification job.

Recall that each neuron competes to respond to an input vector p. If the biases are all 0, the neuron whose weight vector is closest to p gets the highest net input and, therefore, wins the competition and outputs 1. All other neurons output 0. We would like to adjust the winning neuron so as to move it closer to the input. A learning rule to do this is discussed in the next section.


Previous page  Competitive Learning Kohonen Learning Rule (learnk) Next page

© 1994-2005 The MathWorks, Inc.