ash_gamma:

loss = F.nll_loss(output, target, weight=weights)





 ash_gamma:

The number of samples for the classes in train set look something like: [15%, 40%, 30%, 15%]


A question regarding ‘weight’ parameter passed to nll_loss. My priority is to get class 4 right (always), then class 3… so on. So can I pass in weight=[0.1, 0.2, 0.3, 0.4], without taking into consideration the number of samples present in each class? Will this ensure that the network get class 4 right (as best as possible)?
Thanks!