Build a Text Classification Model using Watson AutoAI

Source: Deep Learning on Medium

Build a Text Classification Model using Watson AutoAI

How to train a text classifier using Watson Studio AutoAI without coding

Image by Romain Vignes— Unsplash

AutoAI

AutoAI is an automated tool that helps companies start using ML in a faster and easier way. AutoAI will save you a tremendous time of understanding your data, cleaning the data, preprocessing, feature engineering, training, hyperparameter tuning, and providing model inference APIs. In other words, upload your data to AutoAI then choose the prediction target and the model will be ready within few minutes. Moreover, based on the prediction variable, AutoAI applies the best optimization metric, cross-validation, and train up to 12 different models with different hyperparameters.

Text Classification

Text classification is another task that falls under Data Science and Machine Learning where we assign each document/sentence/tweet one or more classes or categories (labeling nature language text with relevant categories). For example, classifying this sentence “Lionel Messi Named World Player Of The Year In World Soccer Awards” as a “Sport” statement.

Building the model

We will build a classifier that classifies StackOverflow questions to one of the top 20 tags. The data used is available on BigQuery or you can click here to download. This data contains StackOverflow posts with a single tag. 2000 posts for each tag, so 40,000 posts is the total.

First, you need to create a project:

After choosing a project, a similar view should appear. Click on “Add to project” button to start our journey.

There are many different models that you can build using AutoAI. To build a text classifier, click on “Natural Language Classifier”

Training a classifier requires a service. Click “here” to acquire one, if it is your first time.

Choose a plan.

If it is your first time, choose the default setting and click “confirm”

Otherwise, you will be redirected to a page where you can choose one of your services

This is the main page, click “Browse” on the top right corner to upload your file. On the left side, a list of all your tags and posts will appear. That allows you to edit a post, add, delete, rename, etc.

The magic start when you click “Train Model”.

After the training phase, you should get a notification. Click on “here”

You will be redirected to a new page with three tabs: Overview, Test, Implementation

Click on “Test” to test the model. Write a sentence and click “Classify”. You can change the threshold to obtain the results with a specific probability.

Finally, click on “Implementation” and you will be provided with instructions on how to send inference requests to the model.

Thanks for reading. Please let me know if you have any questions!

Resources