Loss Function For Logistic Regression Python