I have a machine learning challenge I may be over thinking. I have a set of 3.5 million products (not unique, there are multiple instances of each product). Each product has a "description" from it's manufacturer which is generally a long strong of a mixture of characters and words. For instance: as3200 wood xd9 dx-9078gl chisel .. it can be quite long (more than 1000 words/chars) You get the idea. In the past, humans have read the product description and then manually typed a name they thought was best. Sometimes "wood chisel" and sometimes " wood chisel as3200", sometimes "pointy wood thing you hit with hammer" (not kidding).

So this is a form of multiclass classification, but there are literally thousands of products. I'm looking for a way to learn the product names, not just classify them into categories. We've already done that with pretty good success.

Instead, we would like to have the algorithm read the description of the product and recommend the right product name. I have a training set of approximately 250,000.
I though this might be suitable for a recurrent neural network, but now I'm not too sure.

Or it could just be as simple as parsing out all the extra characters. Except, sometimes the product name is abbreviated or shortened in non systematic ways. Hence, humans are really good at applying meaning to ambiguous (but close) stimuli.
Any suggestions would be great.


I have been dealing with very similar problem recently, the two differences were that the descriptions were shorter and training set was larger. We tried several approaches, including random forest, recurrent neural network, and cutoffs by TF-IDF-like weights. If you are recognizing products, then I guess that among those 250k samples, you have thousands of products, so samples to products ratio can be quite small (less then thousands of descriptions per product). This means that your training set can be too small for for neural network.

To use classification (random forest, XGBoost, or something else), you would first need to come up with reasonable features. Your target variable would be binary, for each word in description if it is a part of product name, or not. As about features, you can consider things like length of the word (in characters), if it is a number or not, if it is a brand name, same features for preceding and following words. In our case we decided to remove special characters and split strings like "dx-9078gl" to three words ("dx", "9078", "gl"). So in the end, given the features of word and neighborhood words you make a binary decision about a word if you include it, or not.

If you wanted to use neural networks, you can transform data in similar fashion as above, but may need less feature engineering, use embeddings with recurrent networks, and/or attention. In my case, heavy regularization was crucial so that network does not overfit to some strange patterns in product descriptions.

Another possibility is to simply weight words using TF-IDF and take the words with highest weights, with empirical cutoff (take the proportion of "accepted" words among all words, then use appropriate quantile from distribution of TF-IDF scores). In our case, the descriptions were short, so we used similar score inspired by work of Mika Timonen, where words from the end of the description were downweighted and with several additional tweaks, but this may, or may not apply to your problem.

In the end, we decided to use TF-IDF-like scores, because they were cheap and easy to implement, while all the approaches had very similar performance. The performance could probably be better, but there were problems with sample size (still considerably larger then yours) and quality of the data (probably similar to yours, e.g. esoteric names, as in your examples).

  • $\begingroup$ 250K Training set is too small for Neural Nets?? $\endgroup$ – Skander H. Feb 22 at 22:14
  • 2
    $\begingroup$ @SkanderH. it's recognizing products, so if the data is similar to the one I was dealing with, then it's thousands of products, so samples to "classes" ratio is possibly very small. $\endgroup$ – Tim Feb 22 at 23:02

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.