nnCostFunction