Improvement with weighted loss
Opened this issue · 2 comments
robmarkcole commented
My own dataset is very imbalanced, and I achieved superior results using:
weight_for_positive_class = 5
pos_weight = torch.tensor([weight_for_positive_class])
self.criterion = torch.nn.BCEWithLogitsLoss(pos_weight=pos_weight)
AndreaCodegoni commented
Hello Robin!
Thanks for pointing out!
I have a curiosity: to find the weight did you use any type of optimization or make any inference starting from the dataset?
robmarkcole commented
@AndreaCodegoni nothing too flashy I tried a range 3,4,5,10,20