Example 2: Binary Logic Unit
The following is an applet and its
instructions written by Fred Corbett. It is from his website Web Applets for Interactive Tutorials on Artificial
Neural Learning. It is demonstrates
supervised learning using the perceptron learning algorithm. Using
this applet, you can train the perceptron to act as a binary
logic unit. It can compute or approximate most 2-input Boolean
functions. However, a problem arises when trying to train the
perceptron on the XOR (or XNOR) function. The applet provides a
"work-around" for this problem by introducing an extra
input.
Instructions:
To Train The Perceptron:
- Select the desired Boolean function in the truth table.
- Select the desired activation function by clicking the
activation function image. You can also change some
function parameters by holding down the <Shift>
key and then clicking the image with your mouse.
- Adjust the training parameters as desired. Legal values
are as follows:
- Learning Rate: 0.0 to 1.0
- Iterations: 1 to 10000 (I wouldn't want to
try this)
- Error Threshold: 0.0 to 0.5
- Click the Train button to begin a normal
training session OR
- Click the Step button repeatedly to
single-step through the training session.
During Training:
- To stop a training session (normal or single-step) in
progress, click the Stop button.
- A few notes:
- The progress of the training session is displayed
in the progress and status bars.
- The error for the current input vector is
displayed in the Current-Error text
field.
- The sum-squared error over all the input vectors
is displayed in the Sum-Squared Error
text-field
- The perceptron's ability to classify the inputs
into two classes (0 and 1) is shown in a graph in
the top-right corner of the applet. Currently,
this only works for the 2D graph.
To Test The Perceptron:
- After training Click the Test button
repeatedly to cycle through all four input vectors.
- Some notes:
- If the neuron output is correct (within the error
threshold specified), the neuron output
text-field is painted green
otherwise it is red.
- The current error and
sum-squared error are updated and displayed in
their text fields.
To Solve the Exclusive-OR (XOR) Problem:
- Click the Show XOR Solution check box.
- Set the truth table to the XOR function
- Click the Train or Step
button to start a training session.
- Once the training is complete, click the Test
button to check the results.