Why can't Perceptron implement XOR gate?

  • Context: Comp Sci 
  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Gate
Click For Summary
SUMMARY

The discussion centers on the limitations of a single binary perceptron in implementing the XOR gate. Participants confirm that after one training epoch, the weights remain unchanged, leading to repeated outputs. The perceptron in question utilizes a tri-state output {-1, 0, 1}, which complicates the implementation. Key insights include the necessity of randomizing training data between epochs to achieve convergence, as a single binary perceptron cannot represent the XOR function due to its non-linear separability.

PREREQUISITES
  • Understanding of perceptron training rules
  • Familiarity with binary and tri-state outputs in neural networks
  • Knowledge of convergence in machine learning algorithms
  • Basic Python programming skills for algorithm implementation
NEXT STEPS
  • Explore the concept of non-linear separability in neural networks
  • Learn about multi-layer perceptrons and their ability to implement XOR
  • Investigate the role of data randomization in training neural networks
  • Study the implementation of perceptrons in Python using libraries like NumPy
USEFUL FOR

Students and practitioners in machine learning, particularly those interested in neural network architectures and their limitations, as well as Python developers implementing basic neural network algorithms.

shivajikobardan
Messages
637
Reaction score
54
Homework Statement
perceptron xor gate
Relevant Equations
xor gate truth table
1645020070348.png

1645020094661.png


As you can see this is perceptron training rule. I want to learn how it can't implement xor. After 1 epoch/iteration, I get w1=0, w2=0,b=0. does this keeps on repeating? Anyone can implement this algorithm to code in python? Would be nice to see what happens in long run.
 
  • Like
Likes   Reactions: PhDeezNutz
Physics news on Phys.org
  • That is not a binary perceptron, it has a tri-state output in {-1, 0, 1}.
  • The condition for the output state y = -1 is incorrect; can you see why?
  • It is true that you cannot implement XOR with a single binary perceptron: can you think why?
    how can you get ## b + \sum w_i x_i ## to be < ## \theta ## when x = (0, 0) and x = (1, 1)?
  • If the weights are unchanged at the end of an epoch and you run exactly the same training data in the next epoch then obviously the weights will be the same at the end of that epoch as well. We do something between epochs to prevent this, can you remember or work out what this is?
 
  • Informative
  • Like
Likes   Reactions: PhDeezNutz, berkeman and shivajikobardan
pbuk said:
  • That is not a binary perceptron, it has a tri-state output in {-1, 0, 1}.
yeah -1,0,1 are values
pbuk said:
  • The condition for the output state y = -1 is incorrect; can you see why?
why?
pbuk said:
  • It is true that you cannot implement XOR with a single binary perceptron: can you think why?
    how can you get ## b + \sum w_i x_i ## to be < ## \theta ## when x = (0, 0) and x = (1, 1)?

pbuk said:
  • If the weights are unchanged at the end of an epoch and you run exactly the same training data in the next epoch then obviously the weights will be the same at the end of that epoch as well. We do something between epochs to prevent this, can you remember or work out what this is?
oh yeah that's what i thought. idk what we do between epochs? do we randomize? but i don't think i need to go to that depth tho.
 
shivajikobardan said:
yeah -1,0,1 are values
And the first line of the question is "this algorithm is suitable for bipolar input vectors with a bipolar target". Do you see the problem?

shivajikobardan said:
why?
Because values ## - \theta \le y_{in} \lt \theta ## satisfy the condtions for both ## y = 0 ## and ## y = -1 ##.

shivajikobardan said:
idk what we do between epochs? do we randomize? but i don't think i need to go to that depth tho.
What do you mean "go to that depth"? You need to keep training until you achieve convergence, in this case when ## y = t ## for all training data. And yes, between each training epoch you randomize the order of the training data.

Of course if you are trying to create an XOR with a single binary perceptron you will never achieve convergence for the reason hinted at above.
 
Last edited:
  • Like
Likes   Reactions: berkeman

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 3 ·
Replies
3
Views
1K