Do we need to give larger weight to zero class which has more occurrence in the mask ? or the other way round ? because in this reference it says we to need to give more weights to classes which are less.

  
    
    
    Loss weighting for imbalanced classes nlp
  
  
    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? 

You should calculate the weight distribution from your training set. 

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? 

You should be weighing in the i…