When you are training a supervised machine learning model, the algorithm needs a way to calculate how well or how poorly its predictions match the actual target values. Which component performs this calculation by outputting a single numerical value representing the prediction error?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Think of it like this: you're practicing archery. If you hit the bullseye, you did great. If you miss by three feet, you need to adjust your aim. In machine learning, the loss function is the scorecard that tells the model exactly how far off its target it was. It takes the model's predictions, compares them to the actual real-world answers, and calculates a single number representing that error. The goal of training is to get that number as close to zero as possible. Keep in mind, the loss function just measures the error — it's the optimizer that actually adjusts the weights based on that measurement.
Full explanation below image
Full Explanation
A loss function (also known as a cost function or objective function) is a mathematical function that maps the decisions of a machine learning model to a real number representing the cost or error associated with those decisions. In supervised learning, the loss function takes two inputs: the model's predicted values ($\hat{y}$) and the actual target labels ($y$), and calculates the difference between them.
Common examples of loss functions include Mean Squared Error (MSE) for regression tasks and Cross-Entropy Loss for classification tasks. The output of the loss function is used by optimization algorithms (such as Gradient Descent) to compute gradients, which are then used to update the model's weights and biases. Minimizing the loss value over the training dataset is the fundamental mechanism of model learning.
Let's review the distractors: - Outlier detection filters (Option A) are used in data preprocessing to remove anomalous data points, not during the model training/error calculation phase. - Model complexity metrics (Option C), such as parameter counts or structural indicators, measure the capacity of the model, not its prediction errors. - Optimization algorithms (Option D) are responsible for updating the weights of the model (often described in French as "mettre à jour les poids du modèle"). While they use the loss value to calculate how to update weights, they do not calculate the loss itself.
Therefore, the loss function is the correct component.