Incubator-mxnet: weighting gradient feedback of each instance wrt class distribution in case of class imbalance

Created on 26 Feb 2016  路  6Comments  路  Source: apache/incubator-mxnet

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?

Most helpful comment

I'm interested in this as well. It can be done by writing custom loss functions of course.

All 6 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ranti-iitg picture ranti-iitg  路  3Comments

JonBoyleCoding picture JonBoyleCoding  路  3Comments

dmadeka picture dmadeka  路  3Comments

Ajoo picture Ajoo  路  3Comments

Zhaoyang-XU picture Zhaoyang-XU  路  3Comments