Without using any of Matlab's neural network tools, I'm writing a program to simulate an OR gate with a perceptron. I have seen many tutorials, but I still can't understand why we need weights to train a perceptron for such a simple purpose.
One way is to program the perceptron with the conditions (0,0)=0. (1,0)=1. (0,1)=1. (1,1)=1
. So the two inputs to the perceptron would be either zeroes or ones. I don't see the purpose of weights here. Assuming weights are 1, for the second training example, the output would be 1*1 + 0*1 = 1
. For the last example, it would be 1*1 + 1*1 = 2
. So an activation function which says if output >= 1, output = 1 else output =0; end
should suffice. This would successfully simulate an OR gate. So why do I need to "train" any weights?