MultiLabelMarginLoss input formation

The documentation isn’t clear. Is y supposed to be a binary vector, i.e.

[0, 0, 1, 1]

for classes 2 and 3, or a vector of classes, i.e.

[2,3,0,0]

for classes 2 and 3?

For MultiLabelSoftMarginLoss it is clear, but for this one is isn’t.

Have you figured it out? I’m confused about it too.

I was searching the same stuff. To me, it seems the y should be something like:
for a task, each sample can have at most 3 labels:

[0,0,1] ---> y = [2,-1,-1]
[1,0,1] ---> y = [0, 2,-1]
[0,1,1] ---> y = [1, 2,-1]

y includes the index of the target labels, and padded with negative values if num of labels is less than 3(in this example).

Note: I haven’t tested this.

2 Likes