OctoberChang / X-Transformer

X-Transformer: Taming Pretrained Transformers for eXtreme Multi-label Text Classification
BSD 3-Clause "New" or "Revised" License
134 stars 28 forks source link

Class Weight #11

Closed siyanew closed 3 years ago

siyanew commented 4 years ago

Hi,

Is there any way to pass the class weight to this model to have better result in imbalance dataset?

Thanks

OctoberChang commented 3 years ago

There are two ways to adjust the class weight for training the binary classifier. (1) Tune Cp and Cn in the MLModel (https://github.com/amzn/pecos/blob/mainline/pecos/xmc/base.py#L554). This will give different class weight for the positive instances and negative instances of that label. (2) Tune the Relevance matrix (#instances by #labels) for cost-senstive learning in MLProblem (https://github.com/amzn/pecos/blob/mainline/pecos/xmc/base.py#L436).