Training and testing a logistic regression model