Create lrCostFunction