As someone who does machine learning, you’ve probably been asked to build a chatbot for a business, or you’ve come across a chatbot project before.
When I started my ML journey, a friend asked me to build a chatbot for her business. Lots of failed attempts later, someone told me to check ML platforms with chatbot building services. It was nothing but bliss from there.
Businesses these days want to scale operations, and chatbots are not bound by time and physical location, so they’re a good tool for enabling scale. Not just businesses – I’m currently working on a chatbot project for a government agency.
But let’s get back to basics for a moment – what even is a chatbot?
In this article, we will focus mainly on machine learning chatbots.
What is a machine learning chatbot?
A chatbot (Conversational AI) is an automated program that simulates human conversation through text messages, voice chats, or both. It learns to do that based on a lot of inputs, and Natural Language Processing (NLP).
For the sake of semantics, chatbots and conversational assistants will be used interchangeably in this article, they sort of mean the same thing.
Why would you need a chatbot?
Why does your organization need a chatbot?
In an Oracle Survey, 80% of businesses answered that they use chatbots, and 48% are already using automation technology. The global chatbot market is expected to reach $1.23 billion by 2025, with a compounding annual growth rate of 24.3%, according to a Grand View Research report. What are chatbots used for?
- Scaling Operations
Chatbots are great for scaling operations because they don’t have human limitations. The world may be divided by time zones, but chatbots can engage customers anywhere, anytime. In terms of performance, given enough computing power, chatbots can serve a large customer base at the same time.
- Task automation
Chatbots are very effective at automating specific tasks. Once they’re programmed to do a specific task, they do it with ease. For example, some customer questions are asked repeatedly, and have the same, specific answers. In this case, using a chatbot to automate answering those specific questions would be simple and helpful.
- User Engagement
Getting users to a website or an app isn’t the main challenge – it’s keeping them engaged on the website or app. Chatbot greetings can prevent users from leaving your site by engaging them. Short chat invitations let you proactively engage with users.
- Social Media Integrations
Chatbots can be integrated with social media platforms like Facebook, Telegram, WeChat – anywhere you communicate. They can also be integrated with websites and mobile applications. Integrating a chatbot helps users get quick replies to their questions, and 24/7 hour assistance, which might result in higher sales.
- Data generation
When interacting with users, chatbots can store data, which can be analyzed and used to improve customer experience.
- Ability to speak multiple languages
Apart from being able to hold meaningful conversations, chatbots can understand user queries in other languages, not just English. With advancements in Natural Language Processing (NLP) and Neural Machine Translation (NMT), chatbots can give instant replies in the user’s language.
- Connect with younger customers
Statistics show that millennials prefer to contact brands via social media and live chat, rather than by phone. They’re tech-savvy, and they have big buying power. It’s good to satisfy their needs, and have a solid chatbot.
Industries where chatbots can help
- Customer Service
If your company needs to scale globally, you need to be able to respond to customers round the clock, in different languages. Chatbots do that efficiently.
As the number of online stores grows daily, ecommerce brands are faced with the challenge of building a large customer base, gaining customer trust, and retaining them. To successfully achieve these tasks, brands need round-the-clock customer assistance, assist with online purchases, manage payments and also update customers with the latest discounts, create trust and create social engagement.
It can be burdensome for humans to do all that, but since chatbots lack human fatigue, they can do that and more.
Research has shown that medical practitioners spend one-sixth of their work time on administrative tasks. Chatbots in healthcare is a clear game-changer for healthcare professionals. It reduces workloads by gradually reducing hospital visits, unnecessary medications, and consultation times, especially now that the healthcare industry is really stressed.
For patients, it has reduced commute times to the doctor’s office, provided easy access to the doctor at the push of a button, and more. Also, chatbots contribute to cost savings in healthcare delivery. Experts estimate that cost savings from healthcare chatbots will reach $3.6 billion globally by 2022.
- Travel and Tourism
With chatbots, travel agencies can help customers book flights, pay for those flights, and recommend fun locations for vacations and tourism – saving the time of human consultants for more important issues.
- Banking and Finance
Banking and finance continue to evolve with technological trends, and chatbots in the industry are inevitable. With chatbots, companies can make data-driven decisions – boost sales and marketing, identify trends, and organize product launches based on data from bots.
Some banks provide chatbots to assist customers to make transactions, file complaints, and answer questions. Compliance and security are major obstructions to the adoption of new tech in the financial space, but with chatbots, you can build security protocols like two-factor-authentication, token integration, firewalls, 24/7 monitoring, encrypted backends to protect user data, and more.
- Food Services and Grocery Stores
Waiters sometimes mistake food orders. But most food brands and grocery stores serve their customers online, especially during this post-covid period, so it’s almost impossible to rely on the human agency to serve these customers. Using chatbots here has become necessary. They’re efficient at collecting customer orders correctly and delivering them. Also, by analyzing customer queries, food brands can better under their market. Since chatbots work 24/7, they’re constantly available and respond to customers quickly.
Almost every industry could use a chatbot for communications and automation. Generally, chatbots add the much-needed flexibility and scalability that organizations need to operate efficiently on a global stage.
Okay, so we want to build a machine learning chatbot. First, we need a chatbot platform.
What’s a chatbot platform?
A chatbot platform is a service where developers, data scientists, and machine learning engineers can create and maintain chatbots. They offer machine learning features, like NLP. They also let you integrate your chatbot into social media platforms, like Facebook Messenger.
I’ll summarize different chatbot platforms, and add links in each section where you can learn more about any platform you find interesting.
Dialogflow, powered by Google Cloud, simplifies the process of creating and designing NLP chatbots that accept voice and text data. It’s easy to integrate with social media platforms.
Chatbot development takes place via the Dialogflow console, and it’s straightforward to use. Before developing in the console, you need to understand key terminology used in Dialogflow – Agents, Intents, Entities, etc.
For example, an Intent is a task (usually a conversation) defined by the developer. It can be invoked by the user. It’s used by the developer to define possible user questions0 and correct responses from the chatbot.
An Entity is a property in Dialogflow used to answer user requests or queries. It’s usually a keyword within the request – a name, date, location. They’re defined inside the console, so when the user speaks or types in a request, Dialogflow looks up the entity, and the value of the entity can be used within the request.
Dialogflow has a set of predefined system entities you can use when constructing intent. If these aren’t enough, you can also define your own entities to use within your intents.
Moving on, Fulfillment provides a more dynamic response when you’re using more integration options in Dialogflow. Fulfillments are enabled for intents and when enabled, Dialogflow then responds to that intent by calling the service that you define. For example, if a user wants to book a flight for Thursday, with fulfilments included, the chatbot will run through the flight database and return flight time availability for Thursday to the user.
Context can be configured for intent by setting input and output contexts, which are identified by string names.
And so on, to understand all of these concepts it’s best to refer to the Dialogflow documentation.
One good thing about Dialogflow is that it abstracts away the complexities of building an NLP application. Plus, it provides a console where developers can visually create, design, and train an AI-powered chatbot. On the console, there’s an emulator where you can test and train the agent.
Dialogflow provides two different virtual agent services, each with its own agent type, user interface, API, client libraries, and documentation:
- Dialogflow ES: Standard agent type, most suitable to build a simple chatbot. The pricing for this agent service is divided into a free trial edition and the Essential edition. You can learn more about ES via the Dialogflow ES Basics documentation.
- Dialogflow CX: Advanced agent service, suitable for large or very complex agents. It includes flows, pages are the building blocks of conversation design, and state handlers are used to control conversation paths. New developers get $600 free credit to use Diaglowflow CX, and this is automatically activated at the first trial and expires after 12 months. To learn more about this agent type, check out the Dialogflow CX basics documentation.
Companies like Dominos, Shelf, Vonder, and SnapEngage use Dialogflow.
Dialogflow can be integrated with GCP and AutoML to improve training and NLP accuracy.
Amazon Lex is for building chatbot interfaces into any application using voice and text. Amazon Lex uses automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize text intent. There are advanced deep learning functionalities for building applications with highly engaging user experiences and lifelike conversational interactions.
It uses the deep learning technology that powers Amazon Alexa, and it enables you to quickly and easily build sophisticated, natural language, conversational bots.
Like Dialogflow, Lex has its own set of terminologies such as intents, slots, fulfilments, and more.
- Intent: An action or conversation the user will perform/have when interacting with the chatbot.
- Slot: A slot in Amazon Lex is a parameter used in the intent to understand and properly fulfill a user request.
- Slot type: This slot type is a list of values that Amazon Lex uses to train the machine learning model to recognize values for a slot. For example, you can define a slot type called “Genres.” Each value in the slot type is the name of a genre, “comedy,” “adventure,” “documentary,” etc. You can also define synonyms for a slot type value. For example, you can define the synonyms “funny” and “humorous” for the value “comedy.” Every slot type has a maximum of 10,000 values and synonyms. A bot can have a total number of 50,000 slot type values and synonyms. Amazon Lex also provides built-in slot types.
Amazon Lex is free for the first year. From the date you get started with Amazon Lex, you can process up to 10,000 text requests and 5,000 speech requests or speech intervals per month.
Lex has built-in support to integrate bots with platforms like Facebook, Kik, Slack, etc. To integrate your bot with your website or mobile app, you have two ways:
- Use AWS SDK: The AWS SDK provides APIs to send queries to the bot. This requires some level of programming knowledge.
- Using Kommunicate: Kommunicate is human-hybrid customer support software that provides a code-less integration with Amazon Lex, along with a rich chat interface.
Azure Bot Services is an integrated environment for bot development. It uses Bot Framework Composer, an open-source visual editing canvas for developing conversational flows using templates, and tools to customize conversations for specific use cases.
It integrates natural language understanding services like LUIS and QnA Maker, and allows bot replies using adaptive language generation. Composer is available both on desktop and web-based components. It also provides access to adaptive dialogs and language generation.
Adaptive dialog: This is a flexible model of dialog that lets developers dynamically update conservation flow based on context. It makes interruptions, cancellation, and execution of planning semantics a lot easier. Learn more about this in adaptive dialog documentation.
Language understanding (LU): LU is a core component in Composer, it allows developers and conversation designers to train language understanding directly in the context of editing a dialog. As dialogs are edited in Composer, developers can continuously add to their bots’ natural language capabilities. To learn more about language generation in Composer, check out the language generation documentation.
In a nutshell, Composer uses Adaptive Dialogs in Language Generation (LG) to simplify interruption handling and give bots character.
The visual design surface in Composer eliminates the need for boilerplate code and makes bot development more accessible. You no longer need to navigate between experiences to maintain the LU model – it’s editable within the app. You save time with fewer steps to set up your environment.
Composer provides everything you need to build a sophisticated conversational experience:
- A visual editing canvas for conversation flows without the need to write code,
- Tools to author and manage language understanding (NLU) and QnA components,
- Powerful language generation and templating system,
- A ready-to-use bot runtime executable.
Companies that use Azure Bot Service include Daimler, United Parcel Service Inc, Daikin Industries, Telefonica etc.
IBM Waston Assistant, powered by IBM’s Watson AI Engine and delivered through IBM Cloud, lets you build, train and deploy chatbots into any application, device, or channel.
To build with Watson Assistant, you will have to create a free IBM Cloud account, and then add the Watson Assistant resource to your service package. IBM Watson Assistant offers various learning resources on how to build an IBM Watson Assistant.
One concept in IBM Watson Assistant is the use of skills. A skill here means the capabilities of your chatbot. Within the skill, you can create a skill dialog and an action dialog. IBM Watson Assistant also has features like Spring Expression Language, slot, digressions, or content catalog.
Watson Assistant has a virtual developer toolkit for integrating their chatbot with third-party applications. With the toolkit, third-party applications can send user input to the Watson Assistant service, which can interact with the vendor’s back-end systems.
Watson can create cognitive profiles for end-user behaviors and preferences, and initiate conversations to make recommendations. IBM also provides developers with a catalog of already configured customer service and industry content packs for the automotive and hospitality industry.
Developers can also modify Watson Assistant’s responses to create an artificial personality that reflects the brand’s demographics. It protects data and privacy by enabling users to opt-out of data sharing. It also supports multiple languages, like Spanish, German, Japanese, French, or Korean.
Pricing: Building a chatbot using the Lite plan on Watson Assistant is free, but it’s capped at 10,000 API calls. Then Watson Assistant is priced at $0.0025 per API call for the standard version.
Companies such as DB Dialog and DB Steel, BBank of Scotland, Staples, Workday all use IBM Watson Assistant as their conversational AI platform.
Chatbots are very useful in today’s digital economy. They enable scalability and flexibility for various business operations. And, they’re quite simple to build and deploy. They’re a great way to automate workflows (i.e. repetitive tasks like ordering pizza).
I hope this article gave you some ideas on which platform to use for building your chatbots. Thanks for reading!
How to Structure and Manage Natural Language Processing (NLP) Projects
Dhruvil Karani | Posted October 12, 2020
If there is one thing I learned working in the ML industry is this: machine learning projects are messy.
It is not that people don’t want to have things organized it is just there are many things that are hard to structure and manage over the course of the project.
You may start clean but things come in the way.
Some typical reasons are:
- quick data explorations in Notebooks,
- model code taken from the research repo on github,
- new datasets added when everything was already set,
- data quality issues are discovered and re-labeling of the data is needed,
- someone on the team “just tried something quickly” and changed training parameters (passed via argparse) without telling anyone about it,
- push to turn prototypes into production “just this once” coming from the top.
Over the years working as a machine learning engineer I’ve learned a bunch of things that can help you stay on top of things and keep your NLP projects in check (as much as you can really have ML projects in check:)).
In this post I will share key pointers, guidelines, tips and tricks that I learned while working on various data science projects. Many things can be valuable in any ML project but some are specific to NLP.Continue reading ->