Got a two fold question here:
-
How can one tell if they’re working with a multi-label or a multi-class classification?
-
Which loss function should one use in either case?
Thanks!
I think @sGx_tweets might have some good insight to share here
Got a two fold question here:
How can one tell if they’re working with a multi-label or a multi-class classification?
Which loss function should one use in either case?
Thanks!
I think @sGx_tweets might have some good insight to share here
Hi Harpreet,
I think this might help:
BCEWithLogitsLoss (with no sigmoid() or softmax()) is the right loss function for such tasks.
torch.nn.BCEWithLogitsLoss combines a Sigmoid layer and the BCELoss, and is more stable than using a sigmoid layer with BCELoss.
CrossEntropyLoss (without softmax) is the right loss function for such tasks.
It allows for both class indices and probabilistic soft labels as the target tensor.