umbertogriffo/focal-loss-keras

Multi-class classification case

Closed this issue · 3 comments

In the retina net paper, gamma is a unique parameter, but we see in the formula that for each class i, a different class weight alpha_i is given in order to account for class imbalance.

According to this implementation, alpha is given also as a unique value, just like gamma, instead of an alpha value for each class, and I can not understand why.

obviously I'm talking about the multi-class case, not the binary one. In a binary case, a unique value of alpha is enough, as one class would be weighted with alpha, and the second one with (1-alpha). But I'm wondering what happens in a three class classification ?

Did I miss something here ? Thank you for your help.

@georgesmatar
Hi, I have the same concern. Should the alpha be a vector like [alpha_0, alpha_1, alpha_2]?

Hi @chushan89 , @georgesmatar , I come across this: http://www.hawia.xyz/2019/01/12/Losses%20of%20Pytorch%20and%20Focal%20Loss/
You're correct that alpha is just the class weighting factor

Hi @georgesmatar @chushan89 and @hoangphucITJP,
you are right and I've already solved this problem for this previous issue: #4