Weighted learning

Do anyone know how can I do weighted learning(e.g.In sklean.svm.svc ,the parameter ‘class_weight’ allow you to assign different weight to different class ) in CNN with cross entropy loss?Thanks very much!

Just pass the weights as an argument to torch.nn.CrossEntropyLoss

Are the weights simply the proportion of cases in each class? Or is it the inverse of this?

I am on the same boat. Don’t know what weights to put.

Hi All,

Did you get any update on this? Is there any sample code for this?

Thanks