Softmax question

Regarding the Softmax regression: In the examples y=1,2,…,N and j is the same.
The loss function is shown here:


What if y=2,4,6,9 and j=1,2,3,4 do we need to change y to be 1,2,3,4 or do we change the if y part to equal j because j moves from 1 to N and not y.

1 Like

‘N’ is the number of labels.

1 Like

Dear @sdabach,

  • You have labels y are 2,4,6,9
  • Your softmax output indices j are 1,2,3,4

These do not match. If you try to directly use y=2,4,6,9 in the loss formula, it will break because the softmax probabilities are stored in an array indexed from 1…N (as @TMosh said earlier), not your original label numbers.


Keep Learning AI with DeepLearning.AI - Girijesh

Thanks
So I need to translate the real y values to integers running from 1 to N.
And I’ll need to store this translation and convert back to show the true values.

1 Like