# Suggestions for a multi-class text classification model with a large number of classes?

I was working on a text classification problem where I currently have around 40-45 different labels.

The input is a text sentence with a keyword. For e.g. This phone is the most durable in the market is the input sentence and the out label is X and all the words in the output with label X will have durable as a keyword.

What would be a good model to fit this? I tried basic SVM, Random Forest but to no use. I am not sure how to leverage the keyword to create a better model. Any suggestions would be very welcome.

Thanks!

## 2 Answers

you can use LSTM for Text sequence classification. non-neural network classification techniques (ML & Statistical models) are trained on multiple words as separate inputs that have no actual meaning as a sentence. When predicting the class, it will give the output based on statistics rather than meaning. i.e, that each and every word is assigned to one of the categories. In LSTM, this is not the case.  we can use a multiple-word string to determine which class it belongs to. This comes in handy when working with NLP problems. The LSTM model will be able to determine the true meaning of the input string and will provide the most accurate output class.

The first thing I'd suggest is to study the distribution of the classes. Very likely the distribution is imbalanced, and you might have some classes which don't have enough instances to be learned. It depends on the data, but in general classes with less than 10-20 instances probably don't have enough as representative sample.

It's also important to know the proportion of the majority class, if only to know the majority baseline performance. This gives the minimum accuracy that a classifier should reach, otherwise it's not doing anything useful.

In general I would suggest trying first a simplified version of the task, with only on the largest classes. If the classifier works reasonably well in this case, you can (maybe progressively) add more classes. If it doesn't even work in this case, the task is probably hopeless.