Labels starting from 0 or 1


Is there any requirement for labels for start from 0 all the way to 1, 2, 3, number of classes? Or can I have labels start from 1, for example?

This is just a matter of having to apply a label encoder manually to the dataset or not.


Hello Over!

Well, it depends on what you do with the labels.

In the common case that you use CrossEntropyLoss as your loss
function, per its documentation, your labels (the target) must be
integer class labels that run from [0, nClass - 1], inclusive. That
is, the labels start from 0.


K. Frank