In the field of Machine Learning, the Perceptron is a Supervised Learning Algorithm for binary classifiers. The Perceptron Model implements the following function:
For a particular choice of the weight vector and bias parameter , the model predicts output for the corresponding input vector .
NAND logical function truth table for 2-bit binary variables, i.e, the input vector and the corresponding output –
We can observe that,
Now for the corresponding weight vector of the input vector to the AND node, the associated Perceptron Function can be defined as:
Later on, the output of AND node is the input to the NOT node with weight . Then the corresponding output is the final output of the NAND logic function and the associated Perceptron Function can be defined as:
For the implementation, considered weight parameters are and the bias parameters are .
NAND(0, 1) = 1 NAND(1, 1) = 0 NAND(0, 0) = 1 NAND(1, 0) = 1
Here, the model predicted output () for each of the test inputs are exactly matched with the NAND logic gate conventional output () according to the truth table for 2-bit binary input.
Hence, it is verified that the perceptron algorithm for NAND logic gate is correctly implemented.