| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
Training a perceptron to learn the OR Logic gate is simple (and trivial!). Nevertheless, it is a great way to see how the Perceptron Learning Rule can be used. OutlineFor those of you that haven't read the Perceptron essay, please do so. For those of you that have, here is a little review. A perceptron will 'fire' (output is 1) if the net input (sum of the inputs multiplied by their weights) is greater than or equal to one. Otherwise the perceptron will not fire (output is 0). This is summed up by the equation below.
We then compare the output of the perceptron with the desired output, and adjust the weights accordingly.
Now, we are going to train the perceptron to learn the OR-logic gate. The truth table for the OR gate is as follows:
By visualizing the graph of the truth table, it is easy to see that the line separating the points could be y=-x+1. Any line though that passes between the origin and the (0,1)(1,1)(1,0) trio will suffice though.
GuidelinesIt might be a good idea to print the results of the network during each (or even x number) training cycle to get a good look at how the perceptron learns. Also, the line that the perceptron uses to classify is equal to:
where w1 and w2 are the two weights, and b is the bias. Note, that the OR logic gate was chosen simply because it is easy to see and debug. A single perceptron can classify any linearly separable data, therefore try testing your perceptron code with a multitude of data after it works with the OR gate.
Solutions
Submitted: 16/12/2001 Article content copyright © James Matthews, 2001.
|
|
|||||||||||||||||||||||||||
All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -