ex1b (logistic regression) solution.