Given a imbalanced data I would like to set the contribution of each instance to the loss value and the gradient wrt the portion of data with the same category. For instance, if this is 2 classes problem then
Class A with K instances
ClassB with K/2 instances
which means Class B contributes to gradient feedback with coefficient 1 and Class A with coefficient 1/2.
What would be the be4st way to implement it in mxnet? Or do you have any other trick to cope with class imbalance?
You can do it by adding an extra aux variable to the loss layer that holds the scales.
Would you like to propose a PR?
What would be the use of this idea for a new PR? Is it an additional argument to loss layers or any other method? Caffe solves this by using infogain layer which uses a class-wise relation matrix and you can define diagonals of the matrix with these frequency scalers.
I'm interested in this as well. It can be done by writing custom loss functions of course.
How did you resolve it finally?
is there any example for this?
This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!
Most helpful comment
I'm interested in this as well. It can be done by writing custom loss functions of course.