I am trying to build a feed forward network classifier that outputs 1 of 5 classes. Before I was using using Cross entropy loss function with label encoding. However, I read that label encoding might not be a good idea since the model might assign a hierarchal ordering to the labels. So I am thinking about changing to One Hot Encoded labels. I’ve also read that Cross Entropy Loss is not ideal for one hot encodings. What other loss functions can I look into in this case? Also since a new column will be created for each class, how do I “collect” the labels and “feed” them to the proposed loss function?
For example, right now I have:
criterion = nn.CrossEntropyLoss()
.
.
.
loss = criterion(ypred_var, labels)