Skip to content

Focal Loss

Weighted Focal Loss

Weighted Focal Loss applies a scaling parameter alpha and a focusing parameter gamma to Binary Cross Entropy

We take the definition of the Focal Loss from this paper:

where:

This is equivalent to writing:

We calculate the Gradient:

We also need to calculate the Hessian:

By setting alpha = 1 and gamma = 0 we obtain the Gradient and Hessian for Binary Cross Entropy Loss, as expected.