My aim is to predict a star rating from 1-5 based on a yelp review. I’m training a network on a yelp dataset that is severely skewed with 4 star ratings. I’d like to penalize training such that samples with a 4-label do not play as much of a role.
I’m using nn.CrossEntropyLoss(), and I understand that when I call my loss function with the score and train labels I can pass in a weighting vector. My questions are:


Should my weight vector values be calculated from the total distribution or the distribution of the current batch that I’m looking at the specific iteration where I call the loss function?


How should the weighting vector look? If I have 100 examples and the distribution looks like this 1: 10, 2: 10, 3: 10, 4: 50, 5: 20, would I want:
[1/10 1/10 1/10 1/50 1/20] or [10 10 10 50 20], and why?