1-layer NN in python with gradient descent