Comp Sci Why can't Perceptron implement XOR gate?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Gate
Click For Summary
A single binary perceptron cannot implement the XOR function due to its inability to classify non-linearly separable data. The weights remain unchanged after each epoch if the same training data is used without any adjustments, leading to repetitive outputs. To prevent this stagnation, randomization of the training data order between epochs is necessary. The discussion also highlights that the perceptron in question operates with tri-state outputs of {-1, 0, 1}, which complicates the output conditions. Ultimately, achieving convergence in training is essential for successful implementation, which is not possible with a single binary perceptron for XOR.
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.
 
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 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:
Thread 'Why wasn’t gravity included in the potential energy for this problem?'
I’m looking at the attached vibration problem. The solution in the manual includes the spring potential energy but does NOT include the gravitational potential energy of the hanging mass. Can someone explain why gravitational potential energy is not included when deriving the equation of motion? I tried asking ChatGPT but kept going in circles and couldn't figure out. Thanks!

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
3K
  • · 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