linear and logistic regression gradient descent