use scipy.optimize to solve the logistic regression cost function