Modify cost function of logistic regression