Unable to solve the XOR problem with just two hidden neurons in Python

后端 未结 2 2065
灰色年华
灰色年华 2021-02-09 10:05

I have a small, 3 layer, neural network with two input neurons, two hidden neurons and one output neuron. I am trying to stick to the below format of using only 2 hidden neurons

2条回答
  •  生来不讨喜
    2021-02-09 10:32

    It is an unsolvable equation system, that is why NN can not solve it either. While it may be an oversimplification, if we say the transfer function is linear, the expression becomes something like

    z = (w1*x+w2*y)*w3 + (w4*x+w5*y)*w6
    

    Then there are the 4 cases:

    xy=00, z=0 = 0
    xy=10, z=1 = w1*w3+w4*w6
    xy=01, z=1 = w2*w3+w5*w6
    xy=11, z=0 = (w1+w2)*w3 + (w4+w5)*w6
    

    The problem is that

    0 = (w1+w2)*w3 + (w4+w5)*w6 = w1*w3+w2*w3 + w4*w6+w5*w6            <-- xy=11 line
                                = w1*w3+w4*w6 + w2*w3+w5*w6 = 1+1 = 2  <-- xy=10 and xy=01 lines
    

    So the seemingly 6 degrees of freedom are just not enough here, that is why you experience the need for adding something extra.

提交回复
热议问题