L2 loss is a loss function based on the squared difference between predicted and actual values. It strongly penalizes larger errors and is widely used in regression, optimization, and neural network training.
A loss function that calculates the square of the difference between actual label values and the values that a model predicts. For example, here's the calculation of L~2~ loss for a batch of five examples: Model's predicted value --- 6 4 11 6 8 Due to squaring, L~2~ loss amplifies the influence of outliers. That is, L~2~ loss reacts more strongly to bad predictions than L~1~ loss. For example, the L~1~ loss for the preceding batch would be 8 rather than 16. Notice that a single outlier accounts for 9 of the 16. Regression models typically use L~2~ loss as the loss function. The Mean Squared Error is the average L~2~ loss per example. Squared loss is another name for L~2~ loss. where: - $n$ is the number of examples. - $y$ is the actual value of the label. - $\\\\y\$ is the value that the model predicts for $y$. See Logistic regression: Loss and regularization in Machine Learning Crash Course for more information.