Training a logistic regression model with regularization