Answers.Body: <p>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.</p>
  
  <p><a href="https://www.kaggle.com/selener/multi-class-text-classification-tfidf#targetText=Text%20classification%20(multiclass)&amp;targetText=With%20the%20aim%20to%20classify,one%20of%20the%20product%20categories" rel="nofollow noreferrer">https://www.kaggle.com/selener/multi-class-text-classification-tfidf#targetText=Text%20classification%20(multiclass)&amp;targetText=With%20the%20aim%20to%20classify,one%20of%20the%20product%20categories</a>).</p>
  
  <p><a href="https://github.com/susanli2016/Machine-Learning-with-Python/blob/master/Consumer_complaints.ipynb" rel="nofollow noreferrer">https://github.com/susanli2016/Machine-Learning-with-Python/blob/master/Consumer_complaints.ipynb</a></p>
  
  <p>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:</p>
  
  <p><a href="https://medium.com/jatana/report-on-text-classification-using-cnn-rnn-han-f0e887214d5f" rel="nofollow noreferrer">https://medium.com/jatana/report-on-text-classification-using-cnn-rnn-han-f0e887214d5f</a></p>
  
  <p>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.</p>
  
  <p><a href="https://towardsdatascience.com/multi-class-text-classification-model-comparison-and-selection-5eb066197568" rel="nofollow noreferrer">https://towardsdatascience.com/multi-class-text-classification-model-comparison-and-selection-5eb066197568</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-23T21:53:55.483Z
Answers.LastActivityDate: 2019-08-23T21:53:55.483Z
Answers.UserDisplayName: Dan Pavlov
Body: <p>I have a bunch of training data for classifying product names, around <strong>30,000 samples</strong>. The task is to classify these product names into types of product, around <strong>100 classes</strong> (single words).</p>
  
  <p>For example:</p>
  
  <pre><code>dutch lady sweetened uht milk =&gt; milk
  samsung galaxy note 10        =&gt; electronics
  cocacola zero                 =&gt; softdrink
  ...
  </code></pre>
  
  <p>All words in inputs are indexed to numbers, and so classes. I've tried to use tf.estimator.<strong>DNNClassifier</strong> to classify them but no good results. The outcome is just an <strong>accuracy of 4%</strong> which is no meaning.</p>
  
  <p>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?</p>
  
  <p>Are there any existing solutions to classify a list of names? like my product names?</p>
  
Tags: <deep-learning><classification><tensorflow><linear-regression><text-summarization>
Title: Solution to classify product names
UserDisplayName: Dan D.
ThreadText: # Solution to classify product names
  
  (Asked by: username_0 on 2019-08-23)
  
  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?
  
  **Tags:** deep-learning, classification, tensorflow, linear-regression, text-summarization
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-23. Score: 1 | Accepted answer
  
  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>
  
  
  ---
  
  