An Introduction to Chatbots

With the rise of Siri, Google Home, Alexa, and Cortana, it's obvious that there's a demand for chatbots.  In the past, chatbots were more of a niche technology due to limited functionality.  With recent advancements in computer technology, chatbots have now become practical for everyday use.

What is a Chatbot?

First, let’s define the term “chatbot.”  What exactly is a chatbot?

Think of it like a customer support representative.  You contact support, they ask about the problem, you describe them the problem you’re having, they ask further questions to pinpoint the problem, and eventually you get a solution.

Now, replace the person with a computer program, the program being an on-demand Q&A application.  That is a chatbot.

Types of Chatbot

Designing chatbots can be quite complex since you’re dealing with intensive computing power, immense datasets, and ambiguity of natural language.  However, we can derive two main types of chatbots. 

Rule-based Chatbot

In rule-based, a chatbot answer questions based on a series of rules.  These rules are predefined by the developer and depending on the user’s actions, would trigger other rules. 

Rule-based makes developing chatbots simpler as you only need to work in a very limited context.  However, this simplicity also prevent chatbots from getting smarter.

Take the image below as an example.

In the image, our chatbot is geared towards helping users shop on an e-commerce website.  When the user go to the chatbot, the bot will first greet the user.  Usually this is a simple "hello."

While the options aren't limited to the ones shown above, the user can ask to place items into their shopping cart, determine whether an item is in stock, and understanding the refund policy.

Once the user types in a command, the chatbot will perform various actions depending on the task.  The heavy lifting is done in the background and will notify the user once the action has completed.  The user can either follow up with additional commands or just end the conversation.

However, the chatbot cannot handle tasks outside its domain like tracking items for delivery or buying tickets for the movie theater near you.

AI-based

With AI chatbots, you utilize a machine learning model to train your chatbot to handle user input.  Oftentimes, chatbots utilize Deep Learning to derive a model.  Additionally, you can tack on voice to text recognition to provide ease of communication to the user.

Unlike rule-based, you only supply training data to the model and the model will be tailored to the dataset.  This flexibility allows the chatbot to handle complex sentences.  However, since using Deep Learning is complex, it's harder to fine-tune the model.  Additionally, utilizing it can be overkill for chatbots that work in simple environments.

Why the resurgence?

Simply put, we have three things that are going for us today:

  1. Computing power - While there were extensive theory on AI methods in the mid-20th century, the amount of computing power wasn't sufficient.  Due to Moore's Law, we have been able to quickly and dramatically speed up processing power.
  2. Huge datasets - In the past, there wasn't a lot of data to be had for training and utilizing AI models.  With the rise of the internet and complex system architectures need to handle petabytes of data, we know have access to an abundant amount of data.
  3. Resurgence of AI - In early days for AI research, people were overhyping the practicality of AI.  As a result, an AI winter occurred in the 1980s and 1990s.  During this time, there wasn't much research going on due to reduced funding.  However, with the addition of the former two points, AI became more practical for everyday products and solutions.  Whether we will hit another AI winter is up for debate, but there's definitely much research going at the moment.

Conclusion

While we haven't seen general AI, we have definitely seen more powerful chatbots taking hold in our daily lives.  In fact, you can find many blog posts on how to build your own chatbot.  It wouldn't be surprising if chatbots became very human-like in a few years.  Now, whether or not you'll talk to chatbots more than humans is a discussion for another day.


Natural Language Processing: Working With Human Readable Data

Most of the models in machine learning requires working with numbers.  After all, much of the machine learning algorithms we've seen are derived from statistics (Linear Regression, Logistic Regression, Naive Bayes, etc.).  Additionally, machines can understand and work with numbers a lot easier than us human.

However, machines just process the numbers and execute algorithms.  They don't interpret the numbers returned.  They don't understand the context of the data.  They especially don't understand human intricacies and can easily be taken advantage by rouge players.

So then, is it actually possible for computers to understand humans?  Can we ever have conversations with computers?  In a sense, we already can!  This is thanks to a branch of AI called Natural Language Processing.

Read more


When Your Model Is Inaccurate

Let's imagine you're doing research on an ideal rental property.  You gather your data, open up your favorite programming environment and you get to work on perform Exploratory Data Analysis (EDA).  During your EDA, you find some dirty data and clean it to train on.  You decide on a model, separate the data into training, validation, and testing, and train your model on the cleaned data.  Upon evaluating your model using some validation and test data, you notice that your validation error is very high as well as your test error.

Now suppose you pick a different model or add additional features.  Now your validation error is much lower.  Great!  However, upon using your testing data, you notice that the error is still high.  What just happened?

Read more


What are Neural Networks?

I admit, I'm late to the whole Neural Network party.  With all of the major news covering AI that use neural network as part of their implementation, you'd have to be living under a rock to not know about them.  While it's true that they can provide more flexible models compared to the other machine learning algorithms, they can be challenging to work with.

Read more


Overview of Apache Spark

For those wanting to work with Big Data, it isn't enough to simply know a programming language and a small scale library.  Once your data reaches many gigabytes, if not terabytes,  in size, working with data becomes cumbersome.  Your computer can only run so fast and store only so much.  At this point, you would look into what kind of tooling is used for massive amounts of data.  One of the tools that you would consider is called Apache Spark.  In this post, we'll look at what is Spark, what can we do with Spark, and why to use Spark.

Read more


Kaggle's Digit Recognizer dataset

One of the hottest tech disciplines in 2017 in the tech industry was Deep Learning.  Due to Deep Learning, many startups placed AI emphasis and many frameworks have been developed to make implementing these algorithms easier.  Google's DeepMind was even able to create AlphaGo Zero that didn't rely on data to master the game of Go.  However, the analysis is much more basic than anything that was recently developed.  In fact, the dataset is the popular MNIST database dataset.  In other words, the dataset consists of hand written digits to test out computer vision.

Read more


K-means Clustering Algorithm

In my previous post, I mentioned how there are many different algorithms that can be used to cluster a dataset.  One of the most popular clustering methods used is called the k-means clustering algorithm.

Read more


Introduction to Cluster Analysis

If you were to go online and start shopping, chances are you're getting plowed by many suggestions from online sites.  However, these suggestions aren't random, but rather based on what you recently browsed and purchased.  How did they determine what to recommend and what to ignore?

The system described above is called a recommendation system.  The actual implementation, though, is through the use of a method called clustering.  Clustering, in itself, is part of Cluster Analysis.

Read more


Algorithm: Bernoulli Naive Bayes

In my post on Naive Bayes, I mentioned that there are multiple variants that can be used towards different problems.  In this post, I will be introducing another variant of Naive Bayes that utilizes the Bernoulli distribution.

Read more


Introduction to Support Vector Machines

So far, I mainly discussed about classification algorithms that use probabilities to make decisions.  However, there are algorithms that don't require the computation of probabilities.  One of the algorithms that do this is called a support vector machine.

Read more