gradient descent algorithm python from scratch