Neural Network Toolbox Previous page   Next Page

Design (newpnn)

You can use the function newpnn to create a PNN. For instance, suppose that seven input vectors and their corresponding targets are

which yields

which yields

We need a target matrix with 1's in the right place. We can get it with the function ind2vec. It gives a matrix with 0's except at the correct spots. So execute

which gives

Now we can create a network and simulate it, using the input P to make sure that it does produce the correct classifications. We use the function vec2ind to convert the output Y into a row Yc to make the classifications clear.

Finally we get

We might try classifying vectors other than those that were used to design the network. We will try to classify the vectors shown below in P2.

Can you guess how these vectors will be classified? If we run the simulation and plot the vectors as we did before, we get

These results look good, for these test vectors were quite close to members of classes 2, 1 and 3 respectively. The network has managed to generalize its operation to properly classify vectors other than those used to design the network.

You might want to try demopnn1. It shows how to design a PNN, and how the network can successfully classify a vector not used in the design.


Previous page  Network Architecture Summary Next page

© 1994-2005 The MathWorks, Inc.