logistic regression with matrices