Data not balanced

Here is how you can create a weighted vector for scaling the loss of various classes to their representation in the training dataset:

That gets passed into PyTorch Cross Entropy Loss weight argument.

1 Like