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
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