Designing Chatbot Dialog Management

Leave a comment
Artificial Intelligence / chatbot / Uncategorized

People are always fascinated by intelligent devices, and today they are software “chatbots”, which are becoming more and more human-like and automated. The combination of an immediate response and a permanent connection makes them an attractive way to expand or replace the web applications. The high-level diagram of an architecture for a chat-bot shown in Figure 1. Natural Language Understanding component tries to determine the purpose of the user’s input (intent) and useful data (entities). Also, the chatbot has a Dialog Manager to define the flow of conversation and paths that the system will take. Finally, a Language Generation component generates user output.

The main function of a chatbot us to generate an answer for the user request. It can be a direct answer to the question, requesting missed slots, fallback standard input or anything else. Natural Language Understanding module detects intents (which represent the purpose of a user’s input) and entities (an object that provides specific information for an intent). There are many useful NLU tools, like Dialogflow, wit.ai, LUIS or IBM Watson that can help you classify intents and parse entities using its custom deep learning and rule-based models. They have convenient web interfaces and easily integrate with different messaging platforms

There are three main types of dialog management systems:

  • Switch statements
  • Finite state machine
  • Frame-based system
  • Partially Observable Markov Decision Processes

Switch statements is the simplest way to implement a dialog manager. Every intent triggers different responses. The initiative of the conversation always comes from the user and it’s easy to design and implement. But it has significant disadvantages: it doesn’t keep a conversation context and can’t take initiative of the dialogue.

Finite state machine helps your bot to navigate through the conversation flow. The nodes of the graph represent system questions, the transitions between the nodes represent answers to questions, and the graph specifies all valid dialogues. FSMs are useful if you have a limited number of conversational scenarios and structured dialogue. Many commercial bots have this model under its hood, but it lacks flexibility and naturalness. So it’s problematic to develop more complex flow, adding new states and transitions between them. Finally, you can get an unmanageable diagram with a bunch of circles and elements.

In a frame (or template) based system, the user is asked questions that enable the system to fill slots in a template in order to perform a task. This model helps to provide more flexibility to the dialog control because it allows a user to input slots in a different order and combination. Google’s Dialogflow chatbot framework uses a frame-based system with the context control mechanism. Contexts represent the current state of a user’s request and allow your agent to carry information from one intent to another. So you create intents with some entities and design context chains. Dialogflow provides a simple and user-friendly interface for creating and managing your bot agents. 

Partially Observable Markov Decision Processes (POMDP) helps us to combine the idea of statistical dialogue management approach and handling unexpected results. POMDP characterizes by:

  • a set of states S an agent can be in
  • a set of actions A the agent can take
  • a set of observations O
  • a matrix of transition probabilities T
  • a reward R(a, s) that the agent receives for taking an action in a state
  • a dialogue state reward J(s)
  • a discount factor \gamma \in \left[0,1\right]

Classical MDP model defines rewards as a function of belief states, but  POMDP – as a function of the environment state s , because the performance of the model should be measured by the user really wants. Distribution over possible states called a belief state b_t is maintained where b(s_t) indicates the probability of being in a particular state s_t . The aim of the system is then to optimize the expected dialogue reward using this adjusted reward function. The reward could be obtained using the following formula:

J(s_{i}) = \underset{a}{max}\mathbf{\Bigg(}R(s_{i}, a)+\gamma\sum_{j=1}^{N}p(s_{j}\mid p(s_{i}, a)) \times J(s_{j})\Bigg)

So, first of all, you should understand potential users and nature of the tasks through user surveys, research on similar systems and study related human dialogues. Then you need to build a prototype of your conversation flow and try to figure out which dialogue management system will be most appropriate for this task. 

Fast color transfer based on image statistics

Leave a comment
Uncategorized

Color transfer is a long-standing problem that seeks to transfer the color style of a reference image onto a source image. By using different references, one can alter the color style without changing the original image content in order to emulate different illumination, weather conditions, scene materials, or even artistic color effects. It can be used for color correction for rendered imagery, artistic style transfer, turning a day scene into a night scene, image analogies.

Color transfer task defines the following inputs:

  • A content image —  the image we want to transfer the color palette to;
  • A style image —  the image we want to transfer the color palette from;
  • A generated image  —  the image that contains the final result.

A lot of research over the last years has focused on this task. The best results were obtained using deep learning techniques inspired by the idea of semantic-guided transfer. In this case, the network architecture VGG-19 is used for extracting content feature maps. But the number of weight parameters are quite large and the models are very heavy (over 533MB). Due to its size, the deploying VGG is a difficult task especially if you are looking to deploy a model to run locally on mobile. Therefore, we need a fast statistical method that you can easily deploy on mobile platforms.

We present a new method of color transfer based on simple statistics. The main idea of the proposed method is to sort separately content and style image pixels by its brightness, get some statistics from 5-10%, 24-26%, 49-51%, 74-76% and 99-99.5% quantiles of the brightness distribution. We choose the transformation to match the covariance and mean of quantile distribution.

In particular, let x_i = (R, G, B)^T be a source image pixel. Each pixel is transformed as:

x_{S'} = Ax_s + b

where A is a 3×3 matrix and b is a three-dimensional vector. New data points x_{S'} will have the desired mean and covariance:

µ_{S'} = \frac{1}{n} \sum_{i}^{}x^i

Σ _{S'} = \sum_{i}^{} (y_i - µ_i)(y_i - µ_i)^T

We went to find some A and b to satisfy the matching of the style and result image statistics. Hence, the transform is:

x_{S'} = Σ_S^{\frac{1}{2}}Σ_C^{-\frac{1}{2}}(x - µ_C) + µ_S

To compute the square root of the matrix we use a 3D color matching formulations. First, let the eigenvalue decomposition of a covariance matrix be A = UΣU^T . Then, we define a matrix square-root as: A^{\frac{1}{2}} = UΣ{\frac{1}{2}}U^T . Then, the transformation is given by A = Σ_S^{\frac{1}{2}}Σ_C^{\frac{1}{2}} .

At the next step we need histogram equalization and use it to improve the contrast of the source image. Then, we apply linear interpolation to find the covariance matrix and mean for each pixel and calculate new pixel values. And at the last step, we need to clip any values that fall outside the range [0, 255] and merge the channels back together.

However, our method still has limitations. It may mismatch some regions which exist in the source but not in the reference, and thus cause the incorrect color transfer. Our color transfer is suitable for semantically similar images. So, it may lead to some unnatural color effects for image pairs without a semantic relationship, such as the yellow water in the 3rd failure example

This simple algorithm can be easily implemented using different rendering frameworks. You can speed up transformation calculation using GPU unit and achieve 30 fps for 600px*400px frames on the Apple A10 Fusion GPU.

About the author. Anna Khanko is a Machine Learning researcher at Digamma.ai. She received her MS in Computer Science at the National Technical University of Ukraine where she was doing the research on Natural Language Processing. These days, Anna continues to work on NLP and Computer Vision areas, she developed an information retrieval system, chatbots, and image processing applications. Anna is always keen to learn new things and broaden her professional horizons.

Adoption of AI in Healthcare, insights from HIMSS19

comment 1
Artificial Intelligence / Healthcare

 Last month, we’ve attended HIMSS19. If you are not familiar with the event, Healthcare information and Management Systems Society (HIMSS) is an annual healthcare information conference, which brings together more than 45,000 healthcare and information technology professionals from all over the world. 

Artificial Intelligence was a big topic at HIMSS this year. On Monday, we attended “Machine Learning and AI for Healthcare” pre-conference event where health systems, technology companies and clinicians discussed their efforts to utilize AI and Machine Learning to improve healthcare system, boost medical outcomes and reduce costs.

Read More

Seven surprising applications of AI

Leave a comment
Artificial Intelligence / Machine Learning

Everyone is talking about AI applications for healthcare, financial services and self-driving cars. At the same time, creative occupations were previously understood to be immune from the disruptions of AI due to the high levels of intuition and gut instinct, difficult to replicate by complex algorithms, but that is changing now. In this post, I want to talk about 7 lesser-known ways Artificial Intelligence is changing the world around us. Some of these applications might surprise you. Read More

How Artificial Intelligence is Changing Digital Marketing

Leave a comment
Artificial Intelligence / Big Data / chatbot

Artificial Intelligence is changing many industries and Digital Marketing is no exception. Customers today expect personalized and consistent experience across every channel. For the second edition of the “State of Connected Customer” report, Salesforce Research surveyed over 6,700 consumers globally to better understand the mindset of the modern customer. The report revealed that 80% of customers think that the experience a company provides is as important as its products or services. 57% have stopped buying from the company because a competitor provided a better experience.

Savvy marketers know this and rely on Artificial Intelligence to analyze their data to gain a deeper understanding of consumers’ needs, then use these insights to help their organizations deliver improved customer experience. Read More

Digamma.ai AI Q&A Series: Jackie Snow, MIT Tech Review

Leave a comment
Artificial Intelligence / Big Data
fashion digamma ai MIT

Digamma.ai AI Q&A Series: Jackie Snow, MIT Tech Review

1. We are in the very early stages of AI in history. Style is still so complex and there is this sense that AI is trending towards an intelligent assistant that will help us look like we shop at Saks Fifth Avenue regularly and yet do it under budget. In what areas do you believe AI will help consumers and what areas of the style and retail experience do you believe humans still need to do themselves?

I would agree that style is still too complex for AI to get a grip on. So, there’s a long way to go before AI is putting together an outfit for me. Right now, with everything that we’re seeing in the fashion world, I think it’s really geared towards predicting what sort of items a consumer might like to buy. That doesn’t really have anything to do with style. In the meantime, I do think we’re going to have AI that can help surface a lot of different items that we may not necessarily be exposed to through the online shopping environments that are available to us right now. Read More

Digamma.ai Partners With the Institute of Mathematics at the National Academy of Sciences of Ukraine

Leave a comment
Artificial Intelligence / Machine Learning
Institute of Mathematics

Our team here at Digamma.ai is very excited to announce our partnership with the Institute of Mathematics of the National Academy of Sciences of Ukraine in Kyiv.

Through the Kyiv Academic University’s Dual Education Program, we will working with Masters and PhD students from the Department of Mathematics to tackle key machine learning projects together.

With mathematics and statistics as the foundational underpinnings of algorithms that are powering the emerging AI economy, the mathematics field — and researchers in the sector — are experiencing a flood of interest from the private sector.

Through this initiative, we will have an opportunity to work with some of the brightest mathematical minds at the University — which has a long-standing history of exceptional achievements in the field —  and provide an environment for mathematics graduate students to apply their research and knowledge to solving real-life problems using machine learning methodologies. Read More

Digamma.ai CEO Q&A: Amar Chokhawala, CEO of Reflektion

Leave a comment
Artificial Intelligence / deep learning / Machine Learning
Reflektion

Digamma.ai CEO Q&A Series: Amar Chokhawala, CEO of Reflektion

Reflektion seeks to give retailers a deeper understanding of customer intent. How does your company do this from a technology perspective?

In today’s world, everyone is sharing everything. So, the customer’s intent almost starts with temporal signals. When I’m looking for a place to eat in the morning, that means I’m looking mostly at restaurants which are actually serving a breakfast or lunch. Here’s an example of how the temporal aspect comes into play. Imagine a three year old—if you asked her what an “apple” is, she would say it was a fruit. If you posed that same question to a thirteen year old, she would say that it’s the technology company. So, in order to understand customer intent in retail, we need to build a comprehensive user profile that takes into account this temporal dimension. Because if you don’t know the consumer, then you won’t know what the intent of that particular consumer is. Our technology is capable of building those user profiles. We focus on the user first and, to date, have built 600 million plus profiles. That allows us to gain a deeper understanding of customer intent. We use machine learning because, unlike other technology, it works more effectively with more data. The more data you have, the better the model performs. Read More