How to handle a multiclass problem?

I am creating Twitter Sentiment Analysis using ULMFit in Fast.ai

It has 3 different categories negative, neutral and positive but most of the pre-trained model present at this URL https://github.com/fastai/fastai/blob/release-1.0.36/fastai/datasets.py#L7 have only two categories. I think that is affecting my accuracy. So what is the efficient way to handle a multiclass problem?

Does it also make a difference if we assign -1, 0, 1 or 0, 1, 2 to different categories?

You should add a softmax as the final layer, and use the cross-entropy loss function. The output of the softmax will be the probability of being in each of the three classes, and then you could assign the label to the class with the highest probability.

1 Like

Thanks for the suggestion!