How L1 Loss Works
2. Let's Get Practical
Alright, let's say youre trying to guess the weight of five apples. You predicted: 100g, 120g, 110g, 90g, and 130g. The actual weights were: 110g, 115g, 100g, 100g, and 125g.
To calculate L1 loss, you first find the absolute difference between each prediction and the actual value: |100-110| = 10, |120-115| = 5, |110-100| = 10, |90-100| = 10, |130-125| = 5. Notice, no negative signs! We are only considering absolute difference or the magnitude of the errors.
Next, you add up all those absolute differences: 10 + 5 + 10 + 10 + 5 = 40. Then you divide by the number of predictions (which is 5 in our case): 40 / 5 = 8. So, the L1 loss for your apple-weighing predictions is 8g. This means, on average, your predictions were off by 8 grams.
This simple example showcases how L1 loss offers an intuitive understanding of the model's performance. The lower the L1 loss value, the more accurate the model's predictions are. Thats what we are shooting for after all, right? An L1 Loss of Zero signifies that every single prediction was on point. However, don't be disappointed if you never encounter a zero! It almost never happens in practice.