Cost function

The loss function (or sometimes called error function) is a function which compares the output of an ML model as compared to the ground truth for a single training example, while the cost function is meant to be calculated over the entire training set (or mini-batch for mini-batch gradient descent).