Focal loss

Created
TagsLoss

When handling an imbalance class during training, a situation arises in which there are easy samples and hard samples. How can we make the model focus more on the hard examples? Focal loss addresses this by adding weight in such a way that if the samples are easy, the loss value is small and vice versa.


If we set γ as 0, it becomes traditional cross entropy.

FL(pt)=(1p)γlog(pt)FL(p_t) = -(1-p)^\gamma \log(p_t)

In practice, Amazon experiments with focal loss to identify optimal package size best suited to ship each product items.