Derivative of L1-loss

667 Views Asked by At

If y is the ground truth label vector and ŷ the predicted label vector.

Then L1(ŷ) = ||ŷ - y||_1 = (|ŷ_1 - y_1| + ... + |ŷ_n - y_n|) (L1-Norm).

But what is the derivative of L1(ŷ) w.r.t ŷ?

We know the L2-Loss L2(ŷ) = (||ŷ - y||_2)^2 where the derivative w.r.t to ŷ is 2*(ŷ - y) and I would like to calculate the same for L1.

Any tips are greatly appreciated.