Class weights for CrossEntropyLoss

I have an imbalanced dataset, and I’m trying to give custom weights to CrossEntropyLoss. However, I’m not sure whether I should give higher weights to minority classes and lower weights to majority classes, or vice versa. What I understand is that the higher the weights the larger the penalization, but I found in this stackoverflow thread that they’re passing the actual weights of the classes. I.e. if we have classes: A: 100, B: 200, C:300, then the weights would be: 1/6, 2/6, 3/6 respectively (or just 1, 2, 3). My question is: shouldn’t it be the inverse of that? I.e. 6, 3, 2?

I know that there are several formulas to compute the weight, but I’m asking about the general idea. Should the minority classes be given higher weights or lower weights in CrossEntropyLoss?

You would increase the weight for the minority class for add a penalty to the training for a wrong classification of it.
This post explains it with an example.