Your Watson Assistant Can Recommend

Omar Megawer
IBM watsonx Assistant
3 min readNov 3, 2018
Patterns?

One of the capabilities you might want to add to your Watson Assistant chatbot is the ability to predict your user’s next question or topic and be able to proactively ask the user if he/she would like to know about a new relevant topic.

In some scenarios, you might be able to do this manually by just adding messages to certain topics that will introduce another topic/service/product which is inline with the same theme.

Taking this approach might be sufficient in a limited use case but will constrain the responses as the users will always get the same recommendations. Updating the responses on a regular basis isn’t fun at all, as it will require someone to go through thousands of conversations and interpret similarities.

If your virtual assistant has been active for a while, you can create a recommendation model to do the hard work for you and be able to dynamically suggest topics based on behaviors it analyzed.

Now, you may choose to deploy this model through the application that’s connected to Watson Assistant or even using Cloud Functions. It all depends on your architecture.

This jupyter notebook uses 2 different approaches to create a recommendations model. Both will use the pulled logs of the Watson Assistant workspace and analyze user interactions with your assistant to preemptively purpose a new topic for your users based on different behaviors noticed in the data.

First, you will need to pull all the logs of your workspace

It’s good to remove any intents that might bias the model such as yes or no.

Apriori

First method uses mlxtend’s Apriori algorithm which is “ a popular algorithm [1] for extracting frequent itemsets with applications in association rule learning. The apriori algorithm has been designed to operate on databases containing transactions, such as purchases by customers of a store. An itemset is considered as “frequent” if it meets a user-specified support threshold. For instance, if the support threshold is set to 0.5 (50%), a frequent itemset is defined as a set of items that occur together in at least 50% of all transactions in the database.”

The frozen sets show different relations between a certain intent and the most likely intent after it

Recommender System

Another way to do this, is using the turicreate’s recommendations algorithm. As per their definition of a recommender system “A recommender system allows you to provide personalized recommendations to users. With this toolkit, you can create a model based on past interaction data and use that model to make recommendations.” The mathematical concepts for this model can be found here.

After training the model with the logs, you can pass an intent and find out similar intents/topics with it. For your assistant, you can choose to only display recommendations if a high score is observed so that you guarantee you are giving the right response for your user. However, you might not have enough data to make such a decision.

Finally, after deploying the model and connecting it to your Watson Assistant workspace. This is the behavior that you should expect.

The model will keep updating itself whenever a user interacts with it

…very simple concepts can add intelligence to your assistant to better serve your customers.

--

--