Hello bfeeny!



 bfeeny:

0.5090 is the “weight” of my 0 class and 28.36 is the weight of my 1 class.


Yes, I think that is what I am saying.
But, to be concrete, let’s take an extreme example:
Let’s say that your entire training set consists of 1,000 samples,
990 class-“0” samples, and 10 class-“1” samples.  If you want
to reweight the classes in your loss function to fully account for
this imbalance, you would use:
criterion = nn.BCEWithLogitsLoss (pos_weight = torch.FloatTensor ([99.0]))

Best.
K. Frank