A Simsons Chatbot (Keras and SageMaker) – Part 1: Introduction


I was thinking of creating a series, instead of individual posts, for Deep Learning projects, for some time now and I concluded that they are more lightheaded and easy to follow, so here I am!

In this series, we are going to create a chatbot using Keras and SageMaker. I will try to explain the theory as much as I can and I will also post the code in snippets and on my GitHub so you can follow along.

Bellow, I will list the parts for this series, but probably I am going to split them even more:

  1. Introduction – Talk about the technologies we are going to use, reference links of the dataset and other sources.
  2. Gather and Preprocess Data – Download the appropriate data, preprocess them and get them ready for our model.
  3. Gather and Preprocess Data on AWS – We will use AWS for this part. We do not need to, but in a case where you have TBs of data, AWS can be helpful.
  4. Build the model and evaluate it – Build the model using (probably) LSTM and explore evaluation methods. We are going to build our model in AWS SageMaker.
  5. Talk to chatbot –  Use the model and interact with it, final evaluation and discussion


Bellow, I will list the tools we are going to use. It will be good if you have played with these tools before but it is not obligatory(you can follow along).

  1. Pandas for preprocessing data.
  2. Keras for building our model. You can look at my other tutorials on Keras if you want
    1. Digit Recognizer (Kaggle), 0.991 Accuracy with Keras
    2. Convolutional NN with Keras and SageMaker
    3. Convolutional NN with Keras Tensorflow on CIFAR-10 Dataset, Image Classification
  3. AWS Services, handle big datasets(not in our case, but good to know) and creating custom models on Amazon Sagemaker.
    1. We will use Amazon EMR and Amazon SageMaker
    2. Convolutional NN with Keras and SageMaker is a nice tutorial for creating custom models in SageMaker


In this series, we will talk about the LSTM neural network and how to use it. I will try to give a good explanation of how it works and where to use it. Basically is a sequence to sequence learning neural network able to generate “phrases” given a series of “questions” and “answers”. We may also visit the algorithm described here.

Also, we will handle the data using AWS services and build the model and evaluate it on AWS SageMaker.


Now let’s talk more about our data. I will use a dataset from Kaggle which can be found here. If you have a better dataset in mind, you can surely post it in the comment section below or tweet it to me @siaterliskonsta!

For this kind of projects, we need datasets that are like talk and respond. LSTM networks are commonly used for translating texts and phrases, where we have the sequence of phrase in language A and phrase in language B. Obviously the above dataset is not in the described format, but with some manipulation, we can do it. We will need a big dataset for this kind of job and I know that The Simpsons dataset is not big enough but it will be fun! I hope in the end we get a chatbot where its answers make sense and it is also funny.


I will try also to implement a Map-Reduce model in our dataset to preprocess it using Amazon EMR and explain the process behind it. This may be one or two whole parts.


We will use Pandas for opening the dataset and manipulating it.



For the model, as mentioned above, I will use Keras and be more specific LSTM neural networks. We will build the whole model in Amazon SageMaker and we will evaluate it there.



When we are done building our model, we will spawn powerful EC2 instances(if you want to run on your local machine I will explain how) and we will train our model. I will show you how to make predictions using the trained model in SageMaker and how to create an endpoint to use the model on demand.

I hope you will like these series. For me, it is a journey to paths that I really like playing with but never called myself a master. I want to gain more knowledge on AWS, figure things out in the process and at the end come up with a nice result. I want you to experience this journey as I do and at the end of the series leave with some solid knowledge on how to build chatbots and how to use AWS for these kinds of purposes.

Feel free to send me any suggestions, any tips, tricks and anything you liked or disliked. I want to make these series more collaborative, to discuss problems and questions and shape the whole direction of the posts in the process. Let me know in the comments section below or send me a tweet at @siaterliskonsta on my Twitter.

That’s it folks for today. See you in the next post! Take care and bye bye! I will leave you with a quote that I really like.

The true sign of intelligence is not knowledge but imagination.  – Albert Einstein


1 thought on “A Simsons Chatbot (Keras and SageMaker) – Part 1: Introduction”

  1. Pingback: Τι είναι Cloud computing – Υπολογιστικό Νέφος (Cloud Computing)

Leave a Comment

Your email address will not be published. Required fields are marked *