implemented logistic regression with regularization (vectorized)