1
$\begingroup$

When doing a classification task suppose we have 3 targets with notation -2, -1, 0. I read somewhere it is a good practice to Standardize the labels to positive integers.. In this case suppose we change it to 2, 1, 0. Why is it recommended?

Theoretically I don't think it should matter since each class is unique. But in practice it matters, why?

$\endgroup$

3 Answers 3

1
$\begingroup$

Please can anybody be kind enough to explain this to me? When doing a classification task suppose we have 3 targets with notation -2, -1, 0. I read somewhere it is a good practice to Standardize the labels to positive integers. In this case suppose we change it to 2, 1, 0. Why is it recommended?

Can you please link a reference to this!. Usually in practice you wouldn't use integer labels at all. Instead you would use one-hot encoded labels. Here since you have 3 output classes, the neural network will have 3 output nodes. To be concrete the classes can be represented as follows :

  • 0 == > [1 0 0]
  • -1 == > [0 1 0]
  • -2 == > [0 0 1]

where one out of the three bits is turned ON. This is because in practice the output of the neural network may be a sigmoid (output: range[0,1]) or softmax function (output: probabilities)

$\endgroup$
1
0
$\begingroup$

For machine learning frameworks, it is important that the inputs are within well-specified bounds. Requiring target labels to be positive makes subsequent code and interpretation much easier.

$\endgroup$
0
$\begingroup$

When the integers are positive and start from 0, - they can be used as indices to query some collection, like a list of tensors or a list of strings.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.