implementation of Logistic regression