<p>You want to treat the problem as binary classification, and of course use binary cross-entropy.</p>
<p>The only requirement is to ensure to use a sigmoid activation in your model's last layer.</p>

CC BY-SA 4.0
2022-09-27T15:36:53.617Z
2022-09-27T15:36:53.617Z
Edoardo Guerriero
<p>Say my target with classes <code>A, B, C, D, E</code> is <code>[0, 1, 1, 0, 0]</code>.</p>
<p>And my output layer is of B x N where N is the number of classes.</p>
<p>How do I use Categorical Cross Entropy for this?</p>

<pytorch><loss>
How to use Categorical Cross Entropy for Multi-Label Classification?
bluewander
# How to use Categorical Cross Entropy for Multi-Label Classification?

(Asked by: username_0 on 2022-09-27)

Say my target with classes `A, B, C, D, E` is `[0, 1, 1, 0, 0]`.

And my output layer is of B x N where N is the number of classes.

How do I use Categorical Cross Entropy for this?

**Tags:** pytorch, loss


---

## 1 answers

### Answer by username_1 on 2022-09-27. Score: 1

You want to treat the problem as binary classification, and of course use binary cross-entropy.

The only requirement is to ensure to use a sigmoid activation in your model's last layer.


---

