Multi-Label Classification: Overview & How to Build A Model

Multi-Label Classification: Overview & How to Build A Model

Multi-label classification is an AI text analysis technique that automatically labels (or tags) text to classify it by topic. This differs from multi-class classification because multi-label can apply more than one classification tag to a single text.

Using machine learning and natural language processing to automatically analyze text (news articles, emails, social media, etc.), multi-label classification can help categorize text data under predetermined tags, usually topics, like customer service, pricing, etc.

It can be a massive time-saver when analyzing huge amounts of text for your business.

For example, it can be used to assign topics and urgency tags to emails or customer service tickets, in order to route them to the appropriate department and know which ones to prioritize.

Try MonkeyLearn’s NPS Feedback Analyzer to get an idea of how multi-label classification works.

Multi-class vs Multi-label Classifiers

Multi-class classifiers are designed to give each piece of text only one category (or class) tag. For example, if you are classifying “Kinds of Entertainment,” class tags could be: Books, Movies, TV Shows, etc. 

In this example, the tag for “When Harry Met Sally” would be: Movie.

Multi-label classifiers, on the other hand, are able to output several tags at the same time. You could be tagging “Movies” by genre: Comedy, Drama, Romance, Horror, etc.

In this case, “When Harry Met Sally” could be tagged (or multi-labeled) both Comedy and Romance.

Multi-label classifiers are great for customer service, for example, because they can tag a customer ticket with more than one label, so that it could be brought to the attention of multiple departments. Say you are labeling tickets with tags like, Shipping, UX, Speed, Functionality, etc. 

Sample Email

My software arrived a few days late. I was able to install it right away, but now I can’t figure out how to log out.

The above could be tagged as both: Shipping and UX, for example.

MonkeyLearn offers easy-to-use text analysis tools that can help you get the most out of text data, like online reviews, customer surveys, social media posts, and more.

Follow along to learn how to create your own multi-label classifier.

How to Build a Multi-label Classifier

Now you’re ready to train a classifier built for your specific needs.

1. Create a New Classifier

Sign up for a free MonkeyLearn account.

Go to the MonkeyLearn dashboard, click ‘Create a Model,’ then choose ‘Classifier’:

2. Select ‘Topic Classification’

The option to choose from three classifiers: topic, sentiment and intent.

3. Upload Your Training Data

You can upload a CSV or Excel file with social media data, user reviews, support tickets, etc.

If you don’t have a file readily available, click ‘Data Library’ to download a sample dataset.

A selection of apps and sources you can click on to connect and upload your data.

4. Define the Labels/Tags for your Model

Create the set of labels you want your texts to be classified under. Use labels that are relevant to your business goals and keep the total number of labels to just a few (definitely less than 10), at least in the beginning. Machine learning can be trained for extremely complex tasks, but it will learn more quickly if given clearly determined tasks at the beginning.

If you aren’t sure that there will be enough pieces of text for each tag, wait to create that tag until later. And avoid situations where one tag could be confused with another.

Click ‘+’ after adding each tag, then ‘Continue’ when finished adding all tags:

Tags entered into a text field, and added to a classifier for training

5. Train your Multi-label Classifier

Tag each example with the appropriate label(s). Note the example below that’s tagged with two labels:

Text being tagged and classified by clicking on relevant tags.

6. Test Your Multi-Label Classification Model

Now it’s time to test your model. Choose the ‘Run’ tab. 

You can enter text directly in the box by choosing ‘Demo’ in the upper left. Or, click ‘Batch’ and upload a whole new file. 

The model will assign a tag and show you the confidence score. The more you train your model, the more accurate it will become.

New text being entered to test a multi-label classifier.

From here, you can also change your “tagging strategy.” This isn’t necessary because the default is “Autodetect.” But if you’d like to change to “Multi-Tag,” go to the settings of the model and change ‘Tagging Strategy’ to ‘Multi-Tag.’

Click ‘Stats’ to see how well your model is performing. Here you can also see a word cloud for each label to visualize the most used words for each tag.

The 'Stats' menu showing number of texts, Accuracy, F1 Score, and a word cloud to show which words are used most.

If you need to improve the accuracy of your multi-label classification model you can keep training it in the ‘Train’ tab, or retag incorrect labels.

7. Put Your Classifier to Work!

Now that you have a classifier trained to your needs, you can integrate it with apps you already use, like Google Sheets, Zendesk, Excel, SurveyMonkey, and more. Check out the integrations page to learn how. Or integrate your model with MonkeyLearn APIs in the programming language of your choice.

Wrap Up

It’s clear that multi-label classification can be an extremely helpful tool to save time and get the most out of your text data. Machine learning technology can organize hundreds of pages of text in just a few minutes to get powerful insights.

Take a look at this article on customer ticket classification to learn more about a common use case for multi-label classification.

MonkeyLearn’s suite of text analysis tools will help you get the most out of your data. Sign up for free and give them a try.

Rachel Wolff

June 8th, 2020

Posts you might like...

MonkeyLearn Logo

Text Analysis with Machine Learning

Turn tweets, emails, documents, webpages and more into actionable data. Automate business processes and save hours of manual data processing.

Try MonkeyLearn
Clearbit LogoSegment LogoPubnub LogoProtagonist Logo