# Correct numeric labels for classification?

**URL:** <https://discuss.huggingface.co/t/correct-numeric-labels-for-classification/10033>\
**Category:** 🤗Transformers\
**Created:** [September 15, 2021, 5:50pm UTC](https://discuss.huggingface.co/t/correct-numeric-labels-for-classification/10033 "2021-09-15T17:50:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![olaffson](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/olaffson/32/2416_2.png) [@olaffson](https://discuss.huggingface.co/u/olaffson)\
**Post date:** [September 15, 2021, 5:50pm UTC](https://discuss.huggingface.co/t/correct-numeric-labels-for-classification/10033/1 "2021-09-15T17:50:39Z")

</div>

Hello,

This is a simple question but better safe than sorry! My understanding is that the `transformers` class of models (for text classification) can only deal with integer labels as classes.

So it’s up to the user to provide a mapping between labels and scores. In the usual example one could have `0 = negative`, `1 = neutral`, `2 = positive`.

Here is the basic question: do the numeric scores necessarily need to be integers from 0 to N (the number of classes) or I can use any other numbers of my liking? 😅

Thanks!

---

<div class="post-metadata">

**Author:** ![olaffson](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/olaffson/32/2416_2.png) [@olaffson](https://discuss.huggingface.co/u/olaffson)\
**Post date:** [September 29, 2021, 6:16pm UTC](https://discuss.huggingface.co/t/correct-numeric-labels-for-classification/10033/2 "2021-09-29T18:16:01Z")

</div>

yes, I can confirm the labels have to be integers starting at zero. I still wonder what is the mathematical reason for that? Any ideas @nielsr by any chance?

Thanks!
