What Are L1 and L2 Loss Functions?
L1 vs L2 Loss Function
L1 and L2 are two loss functions in machine learning which are used to minimize the error.
L1 Loss function stands for Least Absolute Deviations. Also known as LAD.
L2 Loss function stands for Least Square Errors. Also known as LS.
L1 Loss Function
L1 Loss Function is used to minimize the error which is the sum of the all the absolute differences between the true value and the predicted value.
L2 Loss Function
L2 Loss Function is used to minimize the error which is the sum of the all the squared differences between the true value and the predicted value.
How to decide between L1 and L2 Loss Function?
Generally, L2 Loss Function is preferred in most of the cases. But when the outliers are present in the dataset, then the L2 Loss Function does not perform well. The reason behind this bad performance is that if the dataset is having outliers, then because of the consideration of the squared differences, it leads to the much larger error. Hence, L2 Loss Function is not useful here. Prefer L1 Loss Function as it is not affected by the outliers or remove the outliers and then use L2 Loss Function.
That's it for now.