0
$\begingroup$

I have a bunch of training data for classifying product names, around 30,000 samples. The task is to classify these product names into types of product, around 100 classes (single words).

For example:

dutch lady sweetened uht milk => milk
samsung galaxy note 10        => electronics
cocacola zero                 => softdrink
...

All words in inputs are indexed to numbers, and so classes. I've tried to use tf.estimator.DNNClassifier to classify them but no good results. The outcome is just an accuracy of 4% which is no meaning.

Should it be I'm in the case that classes (Y values) are distributed kinda randomly and too hard to do multi-time linear separation?

Are there any existing solutions to classify a list of names? like my product names?

$\endgroup$
1
$\begingroup$

If you're looking for an existing solution, the best approach I found was using a TF-IDF model, check out the links below which have similar examples which should be easily adapted for your dataset.

https://www.kaggle.com/selener/multi-class-text-classification-tfidf#targetText=Text%20classification%20(multiclass)&targetText=With%20the%20aim%20to%20classify,one%20of%20the%20product%20categories).

https://github.com/susanli2016/Machine-Learning-with-Python/blob/master/Consumer_complaints.ipynb

However if you specifically want to go for a DNN approach, there are a few options you can take for a multi-class text classification. Try looking into a simple CNN classifier, which is a relatively lightweight approach, computationally speaking, yet showing pretty good results:

https://medium.com/jatana/report-on-text-classification-using-cnn-rnn-han-f0e887214d5f

Alternatively, you can use a word2vec or a doc2vec model to map your sentences to unique vectors, and then put them through a regression algorithm.

https://towardsdatascience.com/multi-class-text-classification-model-comparison-and-selection-5eb066197568

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.