logistic regression cost fcn and test