The loss function quantifies the disparity between a model’s predictions and the actual ground truth labels.

At its core, the loss function measures how well a machine learning model is doing in terms of making accurate predictions. In classification tasks, the goal is to assign a label or class to an input data point.

The loss function helps us quantify the “cost” associated with the model’s predictions.

Specifically, it evaluates how far off the model’s prediction is from the actual target label.

The loss function is a mathematical function that takes as input

- the model’s predicted probabilities for each class and
- the true class label.

It then produces a scalar value that indicates the quality of the model’s prediction.

The cross-entropy loss, often used for classification tasks, is insightful for interpretation.

The cross-entropy loss can be mathematically expressed as follows:

In this expression:

`y_i`

represents the true probability distribution of the classes (i.e., the true labels).