loss function and cost function