update logistic regression costFunction