So i didn’t went through all of the code, but:
learning rate = 1 seems pretty extreme to me. Try using something like 0.001, and probably with larger learning_rate_step (0.9? depends on your data set size).
but what i find the most disturbing is your use of variable i, which is used both as the iterator in the main loop of train() and in this line:
data = np.array([list(i) for i in itertools.product([-1, 1], repeat=4)])

I’m pretty sure that this is affecting each other.