Get Explanations For the Classification Results with Watson Categories

Gaurav Kumbhat
Apr 26, 2019 · 2 min read
Image for post
Image for post

AI and machine learning systems are considered as black box especially when they are being consumed with an API. Users may wonder: how did the system predict a certain output and what contributed to the prediction? IBM Watson Natural Language Understanding now makes it easier to understand the results of the categorization feature, by giving explanations for each predicted label. This explanation is provided in the form of snippets from the input text itself that contributed towards the results.

Categories is a hierarchical classification system that predicts labels up to 5 levels of hierarchy. Now, with a simple toggle `explanation: true`, users will be able to get explanations for the predictions. This feature can also be used with our newly released customization of categories. For those who are using this customization option and looking to improve their model, this explanation can come in handy, as it can point towards the text snippets that cause the system to predict incorrect labels.

How can I use it?

{
"url": " https://en.wikipedia.org/wiki/IBM",
"features": {
"categories":{
"explanation": true
}
}
}

This will enable the explanation engine and will return output in the following format:

{
"retrieved_url": "https://en.wikipedia.org/wiki/IBM",
"language": "en",
"categories": [
{
"score": 0.950583,
"label": "/technology and computing/hardware/computer",
"explanation": {
"relevant_text": [ {
"text": "personal computer"
},
{
"text": "ibm pc"
},
{
"text": "computing"
},
{
"text": "floppy disk"
},
{
"text": "computer hardware"
},
{
"text": "computer system"
}
]}
}]
}

In the above output, “relevant text” contains key phrases from the input text that contributed towards the prediction of the label. For example, phrases such as “personal computer”, “ibm pc”, “computing” and “floppy disk” played a key role in predicting “/technology and computing/hardware/computer” as the category label for the input text .

Try it out yourself!

Watson Natural Language Understanding | IBM Watson API Reference

IBM Data and AI

AI Trust | Automation | Language

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store