final version of Logistic Regression