I am doing binary classification on an extremely unbalanced data set where only 2% of the data points are positive. I have found online that 1) the default cross entropy loss assumes equal weights of both classes and that 2) a common way to combat this problem is by re-weighting the scores inside the loss function based on the class imbalance. Indeed most pre-packaged ML softwares include a way to easily implement this reweighing. For example check that the first argument for the BCELoss in Pytorch is the
weight parameter specifically for this purpose.
Now I am trying to write up my experiment and I would like citations for both 1) (that the default loss function assumes equal weights) and 2) ( that this re-weighing is a commonly accepted solution). I find a ton of web pages and code about this about I would like some better sources like text books that explain how this works. Can anyone help me? Thanks.