Neural Network Toolbox Previous page   Next Page

Train the Perceptron

To train the network, click on ANDNet to highlight it. Then click on Train. This leads to a new window labeled Network:ANDNet. At this point you can view the network again by clicking on the top tab Train. You can also check on the initialization by clicking on the top tab Initialize. Now click on the top tab Train. Specify the inputs and output by clicking on the left tab Training Info and selecting p from the pop-down list of inputs and t from the pull-down list of targets. The Network:ANDNet window should look like:

Note that the Training Result Outputs and Errors have the name ANDNet appended to them. This makes them easy to identify later when they are exported to the command line.

While you are here, click on the Training Parameters tab. It shows you parameters such as the epochs and error goal. You can change these parameters at this point if you want.

Now click Train Network to train the perceptron network. You will see the following training results.

Thus, the network was trained to zero error in four epochs. (Note that other kinds of networks commonly do not train to zero error and their error commonly covers a much larger range. On that account, we plot their errors on a log scale rather than on a linear scale such as that used above for perceptrons.)

You can check that the trained network does indeed give zero error by using the input p and simulating the network. To do this, get to the Network/Data Manager window and click on Network Only: Simulate). This will bring up the Network:ANDNet window. Click there on Simulate. Now use the Input pull-down menu to specify p as the input, and label the output as ANDNet_outputsSim to distinguish it from the training output. Now click Simulate Network in the lower right corner. Look at the Network/Data Manager and you will see a new variable in the output: ANDNet_outputsSim. Double-click on it and a small window Data:ANDNet_outputsSim appears with the value

Thus, the network does perform the AND of the inputs, giving a 1 as an output only in this last case, when both inputs are 1.


Previous page  Graphical User Interface Export Perceptron Results to Workspace Next page

© 1994-2005 The MathWorks, Inc.