from numpy import *
X = array([[0, 0],
           [0, 1],
           [1, 0],
           [1, 1]])
y = array([[0, 1, 1, 1]]).T
syn0 = 2 * random.random(X.shape[::-1]) - 1
syn1 = 2 * random.random(y.shape) - 1
for j in range(100):
    l1 = 1 / (1 + exp(-(dot(X, syn0))))
    l2 = 1 / (1 + exp(-(dot(l1, syn1))))
    l2_delta = (y - l2) * (l2 * (1 - l2))
    l1_delta = l2_delta.dot(syn1.T) * (l1 * (1 - l1))
    syn1 += l1.T.dot(l2_delta)
    syn0 += X.T.dot(l1_delta)
print("here:")
print(l2)
