Assignment2_ padding the labels

Hi,
I have a question concerning the chose of -1 as a value for the padding token for labels.
It is mentioned that a log softmax transformation will be performed and the index with greater value will be the index label. Since index starts at 0, it is better to keep the label 0 as a valid index.
This is a fair reason for picking -1 as a value (and not 0) here, but why we didn’t do the same thing in the previous assignment(assignment of week 1) since we also want to pick a class for a generated character that is different than the padding ?

Hi @Ibrahim_RIDENE

We could, but the course creators chose 1 (an unusual choice, 0 was reserved for “[UNK]”). They could have easily chose the value of -1

Choices like these often comes to the developers and the flow of your program (like we had an indexed array of NER tags and wanted to reuse the index to get the text value without adding artificial NER tag for padding value to it; or using spaghetti index (using -1 everywhere)).

In summary, the usual padding value should be 0 and in some rare cases you can justify changing it.

Cheers

Hi,
So it is possible to use the padding value of 0 also in the second assignment rather than -1 ?

It is definitely possible. It’s just easier (they claim) down the road to use -1.