I am attempting to work on the following loss function. To my understanding, this is essentially a BCE loss function where we need to work with the weight parameter. I initially started with


Counting the number of positive examples and then weight =  total_samples / number_positive_per_class. However, clearly this is not what the paper suggests.


I read through the documents and it seems I need to set the pos_weight parameter. However, there is nothing to set the neg_weights as might be needed in this case. So, can I use the ratio of pos_weight = neg_samples/ pos_samples


If this should be the way, can I use the direct ratio or I need to do something else in order to ensure the loss values are correctly weighted?



Any help would be highly appreciated. Thank you