How to calculate weights for BCELogisticLoss function for imbalanced dataset

(Naresh Kumar) #1

Hi Guys,
I am trying to solve one multilabel problem with 270 labels and i have converted target labels into one hot encoded form. I am using BCEWithLogisticloss() function in pytorch as a loss function. Since training data which i have is unbalanced, i am using post_weight argument here but i am bit confused here

pos_weight (Tensor, optional) – a weight of positive examples. Must be a vector with length equal to the number of classes.

Do i need to give total count of positive values of each label as a tensor here or they mean something else by weights here

0 Likes