logistic regression implementation in python