Showing posts with label Machine Learning. Show all posts
Showing posts with label Machine Learning. Show all posts

Saturday, October 13, 2018

Implementing Contextual Chatbot Framework

gk_ wrote a really good piece on developing a contextual chatbot framework in Python using tflearn.

We’ll be working through 3 steps:

1. We’ll transform conversational intent definitions to a Tensorflow model

2. Next, we will build a chatbot framework to process responses

3. Lastly, we’ll show how basic context can be incorporated into our response processor

He develops a simple framework that is easy to build from. When I say "simple" I mean that it is easy to follow and would be easy to extend. It is not simplistic by any means. In fact, for the most part, it is significantly more sophisticated than Microsoft's botbuilder framework and Amazon's LEX framework. (We're not even going to compare it to IBM's hopelessly unusable Watson or Blue or whatever-it's-being-sold-as framework.)

gk_ also demonstrates a clean way to represent training data in a json file. I have my own way of representing training data, but it's not better than his. His training data and bot-configuration are all in a single json file and that is the only part of the solution that is application-specific. In other words, the framework he presents in his article will adapt to any domain by simply changing the json configuration file. I like that.

What does his framework get right? A number of things but providing context for subsequent intents is very powerful. One problem I've dealt with is how to let a user navigate backwards through a dialog or ask for help or any other context specific question. My way of dealing with that in the past has been to create some navigation intents (GOBACK, HELP, WHYDOYOUASK, etc.) and then check for those intents before looking for other intents. The way I've dealt with it is fine, but I like his better.

I do wish that frameworks had the ability to "GOBACK" to the previous question. In chatbots such as he's modeled, it's not important to be able to do that. But in a chatbot that is guiding a user through a long conversation, the ability to "GOBACK" is important to usability. The good news is that his framework could be extended to handle "GOBACK" if necessary.

The other thing his framework does not do is provide any concept of intent slots that must be filled. That's really LEX's strength--the definition of intent slots and then the dogged prompting of the user until all the slots are filled.

Getting Started with Tensorflow via TfLearn

Adam Geitgey has written an excellent series showing how to get started with machine learning. He chose tflearn as his API.

This guide is for anyone who is curious about machine learning but has no idea where to start. I imagine there are a lot of people who tried reading the wikipedia article, got frustrated and gave up wishing someone would just give them a high-level explanation. That’s what this is.

His five-part series takes you through classification models, price-prediction models, and ultimately shows how to use machine learning to analyze all the recognizable objects in a photo.
9.4Thomas James Daley