0
$\begingroup$

How do we design a neural network with one hidden layer, two hidden neurons and an output neuron that implements an XNOR function? The truth table of XNOR is given below:

enter image description here

And how to provide weight and bias coefficients of this network?

$\endgroup$

2 Answers 2

0
$\begingroup$

Combine a NN for x1 AND x2 [your a1] with a NN for (NOT x1) AND (NOT x2) [your a2] to get the XNOR. You end up with inputs +1, x1, and x2 going to your hidden neurons a1 and a2, then +1, a1, and a2 into your output neuron.

$\endgroup$
0
$\begingroup$

The network topology to solve the XNOR problem is no different than the topology for the XOR problem. The only difference is the output labels to achieve desired results, i.e., the truth table for XNOR is only slightly different than for XOR. You could simply use a 2-2-1 feedfoward topology with random weights in the unit interval (0,1), no bias terms, ReLU or Sigmoid activation in the first dense layer and sigmoid activation in the second dense layer.

See http://dx.doi.org/10.13140/RG.2.2.13734.91206 which gives a good intro to XNOR problem and provides a solution to the slightly more challenging XNOR-type nonlinear distribution problem in 2D using a single layer neural network. The solution includes code in Python. Best of Luck.

$\endgroup$
1
  • $\begingroup$ only url answer $\endgroup$
    – fuwiak
    Aug 15, 2023 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.