Problem with loss function for multi-label classification with sparse target matrix

Found a solution for my Loss function.
I ended up using the BCEWithLogitsLoss function,
but i used a weight the positive labels higher.

learn.loss_func  = torch.nn.BCEWithLogitsLoss(pos_weight=torch.tensor(10.))

These two links where helpfull for me.


8 Likes