batch gradient descent python from scratch