Loss_ToolBox-PyTorch
Loss_ToolBox-PyTorch copied to clipboard
balance_index: (int) balance class index, should be specific when alpha is float
Hi @Hsuxu ,
I'm a little bit confused about balance_index.
What happens to the loss when alpha is of type float?
Millions of thanks in advance.
It only apply alpha weight on target class index.
It seems that $balance_index will not be used when the type of $$\alpha$$ is integer.
So, what does the balance_index actually do ?
thx.
@DeeDive Alpha should be between 0 and 1 and reflects the relative weight of the classes. For example, if you have binary classification and you want to overweight the positive (index 1) class, I believe you can set alpha=0.7 and balance_index to 1. Then the alpha matrix will have all 0.3 (i.e. 1-alpha) for column 0, and 0.7 for column 1. This is used then for weighting the loss later in the computation
Thanks for your reply. Can I set alpha to a vector of integer? For instance, [1,7].------------------ 原始邮件 ------------------ 发件人: "Karthik Sarma"[email protected] 发送时间: 2019年8月18日(星期天) 凌晨0:03 收件人: "Hsuxu/Loss_ToolBox-PyTorch"[email protected]; 抄送: "DeeDive"[email protected];"Mention"[email protected]; 主题: Re: [Hsuxu/Loss_ToolBox-PyTorch] balance_index: (int) balance classindex, should be specific when alpha is float (#9)
@DeeDive Alpha should be between 0 and 1 and reflects the relative weight of the classes. For example, if you have binary classification and you want to overweight the positive (index 1) class, I believe you can set alpha=0.7 and balance_index to 1. Then the alpha matrix will have all 0.3 (i.e. 1-alpha) for column 0, and 0.7 for column 1. This is used then for weighting the loss later in the computation
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.