Implementation of AND/OR/NOT Gate using Single Layer Perceptron

Procedure

The following procedure is to be followed for the simulation:

  1. Select any one of the gates from the dropdown. By default, AND Gate is selected.
  2. Click on button.
  3. Now, wait and observe how the I/P combination is interpreted by the neural network.
  4. After the neural network completely interprets each I/P combination, the button gets enabled. After understanding how this I/P combination was interpreted by the neural network, you can click on this button. After clicking on this button, this button gets disabled until the next input is completely interpreted by the neural network.

After the entire simulation is completed, you will get a popup indicating this completion. Now you may select another Gate and run the simulation.

At any point of time during the simulation, you can stop the simulation by clicking on the button.

The correct outputs will be obtained by the neural network only for certain ranges of inputs.
You can easily visualize this using the graph. When the line (decision boundary) is such that points that look same are on the same side of the line, then correct output has been obtained.

E.g. In the following plot, similar points are not on the same side of the line.. Hence, the weights and threshold chosen provide an incorrect output for the corresponding Gate.
SS2
E.g. In the following plot, similar points are on the same side of the line. Hence, the weights and threshold chosen provide a correct output for the corresponding Gate.
SS1
Note: If you choose negative weights and a negative threshold, then the decision boundary might recognize similar points in the same class. But here the output will be for the opposite class. To see this, try -1 as weights and -1.5 as the threshold in AND Gate simulation. This will give incorrect outputs.

* Hint for all the gates in order to obtain appropriate outputs is given in the Post Test Section.