Chatbots : What & Why?

robot-customer-serviceThe word ‘chatbots’ has become one of the most whispered words in the tech world today. Each and every tech company is putting a lot of effort on researching and developing bot related technologies.

The very first thing that you should keep in your mind is “Bot is not an acronym neither a magic app”. Bot is an application that operates as an agent for a user or another program or simulates a human activity.

I would say, there’s no Artificial intelligence or natural language processing attached with most of the chatbots you see out there. But AI and machine learning have become prominent factors of giving bots more human side.

The evolution of chatting paradigms and the rapid adaptation of millennials for chatting platforms like Facebook messenger, WhatsApp and Viber increased the need of chatbots that can handle business processes.

df

Evolution of user interaction

The same way a website is interacting with a user, bot acts as the interface into the service. Simplicity, increasing productivity, personalized service lines are some of the major benefits that we can achieve with getting chatbots into the play.

Super bots Vs domain specific bots

Probably the very first thought that comes to your mind when it says ‘bots’ might be “Siri, Cortana or Google assistant”. Dominating our pockets with their ability of interacting as a personal assistant, these software utilities can be defined as super bots. They are equipped with speech recognition as well as natural language understanding. Normally there’s a persona specifically designed for these super bots. The backend of these intelligent applications is backed with machine learning and deep learning based technological interventions.

we-put-siri-alexa-google-assistant-and-cortana-through-a-marathon-of-tests-to-see-whos-winning-the-virtual-assistant-race--heres-what-we-found

AI powered personal assistants in your pocket and home

Domain specific bots are easy to find and easy to build (comparatively to the super bots). They are specifically designed aligning to a particular business process.  Ordering a pizza from nearest pizza shop, customer service call centers or booking a flight ticket are some example business processes that can be easily adopted to a conversational bot interface. These bots may use machine learning techniques for natural language understanding.

Business bots Vs Consumer bots

Bots are not only mend to be to involve in business process. Fun is mandatory! The consumer bots are specifically designed to maintain human like conversations with the users. Sometimes even for flirting 😉 Mitsuku is known as one of the prominent consumer bots that have built for today.

Text or the voice?

Interacting with a chatbot can be done in several ways. Textual communication is just one thing. Speech recognition enables the user to interact with the chatbots with speech. Some chatbots provide interactive clickable cards for user interaction. Amazon Alexa even has a hardware component that interacts with the user with voice commands.

Building bots

There are plenty of programming paradigms prevailing today that helps you to build conversational bots. Microsoft Bot Framework is a programmer friendly framework that supports C# or node.js for deploying bots. Integrating chat channels like Skype and messenger can be too done through the framework.

Natural Language understanding provides more human like nature for bot’s conversations. For that, LUIS service by Microsoft, API.AI, wit.ai are some prominent services used today by the programmers. No need to go from the scratch of machine learning algorithms. Just an API call will do the magic for you.

Bots can be given more human like abilities with machine learning based intelligent API services and SDKs. Microsoft Cognitive services is a valuable toolset that you can use to give your chatbot the ability to see, hear and even think!

What’s next?

I guess, codeless bot building services (some are already there in the market, but not so matured) and natural language generation would be the next big things in the conversational bot building industry. Deep learning will come to scene with language generation for sure.

Time to market is a prominent factor in the world of business. Then why not going with the trend and adopt a chatbot for your own business or start building bots as your business? 😉

Advertisements

Tips & Tricks for building a better LUIS model

Windows-Live-Writer-1ea16f646b8b_EBC7-image_6b0e682f-3c30-4d18-a764-b7a8375e6ffeChatbots has become a ‘trend’ today. Everyone wants to attach a chatbot for their businesses. Either to the public facing phase or as the interfering interface of an internal business process. If you observe the social media handles of the major brands, they are using chatbots to communicate with their customers.

Building a bot from the scratch is not an easy task and there’s no need of going from the scratch! There’s plenty of frameworks and language understanding services that you can get the aid of.

Api.ai, Recast.ai, Motion.ai, rasa NLU, Wit.ai, Amazon Lex, Watson Conversation and LUIS.ai are some of services that you can use individually or with the use of other channels and frameworks to build your bot.

Here I’ve listed out some of the best practices I use when creating a language understanding engine using LUIS.ai; which is Microsoft’s NLU product framework.

(To get started with LUIS.ai refer the documentation here – https://docs.microsoft.com/en-us/azure/cognitive-services/luis/home )

Narrow down the scope of the bot

Don’t ever try to put up a Bot with a wide scope. First thing you should get into your mind is “LUIS doesn’t’ generate the answers for the questions. It just direct the questions come into the service into pre-defined answering lines.” Although LUIS limits the number of intents for a single LUIS model to 80, try to reduce the number of intents because it increases the probability of getting the right intent for the questions you ask. Lots of intents may confuse the language understanding algorithm of LUIS. It may lead your program to a wrong intent.

Use a good naming convention for the intents and entities

When you plan to build a LUIS model, choose a good naming convention. Else It would be hard for you when you referring the particular intent from your code. Don’t use too lengthy words as intent names. Just use short descriptive wordings. Using Camel case or dot separated phrases is a good practice.

As an example, for creating a Bot for a Pizza shop, these are some sample intents that you can use.

  • General.Introduction – Shows a general introduction about the coffee shop
  • General.ContactDetails – Show the contact details
  • General.ShowPriceList – Display the full price list of the coffee shop
  • Order.Pizza – Pizza ordering process starts
  • Order.ConfirmOrder – Confirm the placed order
  • Order.CancelOrder – Cancel a placed pizza order
  • Feedback.RecieveFeedback – Receive customer feedback.

Using this kind of dot separated phrases helps you to see the same kind of intents together in a row in your LUIS dashboard.

Use Entities wisely

Entities let you change the answer of a particular intent dynamically. It also let you to reduce the number of intents. If you using dynamic SQL queries to fetch data in your bot, entities may help you to build those queries with the appropriate parameters.

There are four types of custom entities as Simple, Composite, Hierarchal and List. If you want to identify a set of names from the question (Names of pizzas etc.) use the List type of custom entity. It increases the discoverability of the entity. You can add 20,000 items for a single list. Never forget to add the synonyms for the list items. Bot have to think from the user’s language.

img_3

Adding a item for a List type entity

There a set of pre-built entities that you can use. If you want to extract a number, age, date kind of data from the question, don’t hesitate to use them.

img_1

Pre-built Entities

Train the model with the maximum number of utterances that you can think of! –

Programmer never knows how the end user going to think. So, train each and every intent with the maximum number of utterances that you can think of.

Do check the model and improve it regularly

Even after publishing the LUIS model for the production, make sure to check the suggested utterances and retrain the model with them assigned for the correct intent.

Beware! LUIS is not from your country!

LUIS may capable of identifying a name of city in your question where you want it as an entity value. Sadly, LUIS may not recognize the name of your hometown as a city If it’s not popular as Paris or New York! So, use the ‘Feature List’ for this kind of applications. LUIS may learn that the similar kind of items in your feature list should be treated same. It doesn’t do a strict mapping. Just a hint for the algorithms behind the LUIS engine.

Do version controlling

Training the LUIS model with some utterances may lead it to push out some wrong predictions. Maintaining the clones of the previous versions may help you to rollback and start from the place you were right. Do clone the model when needed.

img_4These are just small tips you can use when building your own LUIS model. Do comment any best practice that you find useful in building an accurate model for your Bot.

 

Image Classification with CustomVision.ai

cv1Extracting the teeny tiny features in images, feeding the features into deep neural networks with number of hidden neuron layers and granting the silicon chips “eyes” to see has become a hot topic today. Computer vision has gone so far from the era of pattern recognition and feature engineering. With the advancement of machine learning algorithms combined with deep learning; understanding the content in the images and using them in real world applications has become a MUST more than a trend.

Recently during the Microsoft Build2017 conference, they announced a handy tool for training a machine learning image classification model to tag or label your own images. Most interesting part of this tool is, it provides an easy to use user interface to upload your own images for training the model.

After training and tuning the model you can use it as a web service. Using the REST API you just have to push the request to the web service and it’ll do the magic for you.

I just did a tiny experiment with this tool by building an image classifier that classifies few famous landmarks.

I’ve the following image set

  • Eiffel tower – 6 images
  • Great wall – 11 images
  • KL tower – 7 images
  • Stonehenge – 7 images
  • Space Needle – 7 images
  • Taj Mahal – 7 images
  • Sigiriya – 8 images

Let’s get started!

Go to customvision.ai – just sign in with your mail id and you’ll land onto the “My Projects” page

cv2Fill the name, description and select the domain you going to build the model. Here I’ve selected Landmarks because the images I’m going to use contains landmarks and structural buildings.

I had the images of each landmark in separate folders in my local machine. I uploaded the images category by category.  System will detect if you upload duplicate images.

cv4All together 53 images with different tags were uploaded for training.

Training will get few minutes. Optimize the probability threshold to get the best precision and recall. Then get the prediction URL. What you have to do is simply forward a JSON input for the Prediction API.cv7

You can retrain the model by tagging the images used for testing. In a production environment, you can use the user inputs to make the perdition model more accurate. The retrained model will appear as a different iteration. You have the freedom to choose the best iteration that should go live with the API.

You can quickly test how well the model you built us performing. Note that any ML model isn’t giving you 100% accuracy.

cv6

cv9

A prediction from the API

If you prefer to do this in a programmatic way, or your application need to do all the training and calling in the backend, just use Custom vision SDK.

https://github.com/Microsoft/azure-docs/blob/master/articles/cognitive-services/Custom-Vision-Service/csharp-tutorial.md

The SDK comes pretty handy with training new models and adding labels for the images and training it before publishing the prediction API.

Grab a set of images. Build a classifier or a tagger. Make your clients WOW! 😃