Gradient descent for logistic regression