Logistic Regression Function Python