Why is a simple 2-layer Neural Network unable to learn 0,0 sequence?

后端 未结 1 1235
攒了一身酷
攒了一身酷 2021-02-01 21:52

While going through the example of a tiny 2-layer neural network I noticed the result that I cannot explain.

Imagine we have the following dataset with the corresponding

1条回答
  •  天命终不由人
    2021-02-01 22:20

    The classification is right as well. You need to understand that the net was able to separate the test set.

    Now You need to use an step function to classify the data between 0 or 1.

    In your case the 0.5 seems to be a good threshold

    EDIT:

    You need to add the bias to the code.

    # input dataset
    X = np.array([ [0,0,1],
                   [0,0,1],
                   [0,1,0],
                   [0,1,0]])
    
    # init weights randomly with mean 0
    weights0 = 2 * np.random.random((3,1)) - 1
    

    0 讨论(0)
提交回复
热议问题