I received a data set containing a string of text and a label that categorizes that text into one of 50 categories. I'm hoping to build a model that predicts which category a string of text belongs in.

When the dataset was put together, it was assembled under the assumption that each string of text can only belong to one group. In actuality, the text can belong to more than one group simultaneously.

Instead of going back to the drawing board and manually labeling the data again, I want to try and convert this single-label data set into a multi-label data set.

I've tried one method with questionable results. I built a linear regression that predicts each category individually, and appended those predictions to the original data. While this gave me data in the structure I needed, it yielded lackluster results. Most strings of text still only belong to one category (many should belong to multiple), and a good portion weren't assigned any label at all.

It seems that even if I can "Frankenstein" this data together, it may not serve as quality training data. I'm curious, is there's any great way of transforming this single-label data into multi-label data?


You should consider using a neural network for this. By using binary crossentropy across multiple categories, you can get a probability "rating" for each category and how it applies to the text. From there, you can develop a script that establishes a threshold (say 0.8) and then creates a new entry of labeled data for that one particular piece of text across multiple categories. There are many examples out there of people taking IMDB data and the movie descriptions and assigning multiple genres to a single movie (like a "horror" movie can also be a "suspense" movie or a "comedy" movie can also be an "animated" movie). Those types of examples should fit what you need here.

  • $\begingroup$ Would a neural network achieve different or improved results? When I used the linear regression, I predicted a probability of a text being in the category or not. The text is really short by the way, probably less that 30 words on average. $\endgroup$ – Stephen Witkowski Jan 16 '19 at 17:14

Is it possible to do some form of clustering?

I am actually trying to do this as well (turning a single label data to a multi-label data except my data is in the form of time series). Therefore, in my case, the time series can be transformed into a pairwise distance matrix. Then using some form of clustering method (k-means) the time series of similar shapes/patterns can be group together. Finally, each sample in each cluster can have all the labels that are currently in the same group.

I am not sure will this be the correct approach as I am looking into it as well. Hopefully, there are other experts who are able to provide some insight


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.