Perda L2, comumente referida como Erro Quadrático Médio (MSE), is a popular função de perda usada em aprendizado de máquina and modelagem estatística to measure the accuracy of a model’s predictions. It quantifies the difference between the actual values and the values predicted by the model.
Matematicamente, a Perda L2 é calculada tirando a média das diferenças ao quadrado entre cada valor previsto e o valor real correspondente. A fórmula é dada por:
L2 Loss = (1/n) * Σ(actual – predicted)²
where n is the number of observations, actual is the actual value, and predicted é o valor previsto.
The key characteristic of L2 Loss is that it heavily penalizes larger errors due to the squaring of the differences. This property makes it sensitive to outliers, which can significantly affect the perda geral value. As a result, L2 Loss is often used in regression tasks where the goal is to minimize the error between predicted and actual values, leading to more accurate models.
While L2 Loss is widely used, it may not always be the best choice, especially in situations where outliers are present. In such cases, alternative loss functions like L1 Loss (Erro Médio Absoluto) ou Huber Loss podem ser mais apropriadas.