tech talks at applozic

Understanding Word Embeddings – Tech Talks at Applozic

Understanding how different words are related based on the context they are used is an easy task for us humans. If we take an example of articles then we read a lot of articles related to different topics. In almost all the articles where an author is trying to teach you a new concept then the author will try to use the examples which are already known to you, to teach you any new concept. In a similar way computer also needs a way where they can learn about a topic and where they can understand how different words are related.

Let me begin with the concept of language, these amazing different languages we have. We use that to communicate with each other and share different ideas.

But how do we explain a language in a better way? Some time back I was reading this book “Sapiens”, where the author goes back and questions a lot of things and in that, his explanation of language was good:

We can connect a limited number of sounds and signs to produce an infinite number of sentences, each with a distinct meaning.
We can thereby ingest, store and communicate a prodigious amount of information about the surrounding world.

This is all possible because of languages. As he writes we can produce an infinite number of sentences, that means words will have different meanings based on the context used. So rather than having a fixed definition for each word, we’ll be defining them based on their context.

That’s the reason in programming we don’t use WordNet to find out the relationship between different words. WordNet is a library where you can get a collection of synonym sets for each word. Also, it contains hypernyms (‘is a’) relationships. It misses the nuance, for example, the word ‘good’ has a lot of synonym sets but the context is missing. One more problem with WordNet is that it requires human labor to create and update.

We need a way where we can compare the word similarity. To compare it we need to represent the words in the form of vectors. We can represent them in the form of discrete symbols. Representing them as one-hot vectors like:

hotel = [0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]

 

So, the vector dimension will be equal to the total number of words in a vocabulary. Still, we can’t find the similarities between different words in this way as each word is represented differently and there is no way to compare. One way to fix that would be to use WordNet’s list of synonyms to get the similarity or what if we can add similarities in the vector itself?

The idea here is to create a dense vector for each word, chosen in such a way where it is similar to vectors of words that appear in similar context. Word2Vec is what we are going to use to create such a dense vector.

Word2Vec

Let’s say we are reading a book and our task is to learn how different words are related to each other. What we will do here is we’ll take a paragraph and we will go through each word. One word at a time, let’s call it a center word. Then we have nearby words, let’s say there are five words in one sentence and center word is the middle one then two words on the left side and two on the right are nearby words. These are also known as context words. Here we take two because we have a window of size two, it can be changed.

Here we will calculate the probability of a context word given a center word or vice versa. Based on this probability we will adjust the word vectors and try to maximize the probability. This way we will get word vectors through which we will know if any two words are similar.

Word2Vec was introduced in 2013 by Mikolov et al. at Google on efficient vector representations of words. This is the abstract of the paper:

We propose two novel model architectures for computing continuous vector representations of words from very large data sets. The quality of these representations is measured in a word similarity task, and the results are compared to the previously best performing techniques based on different types of neural networks. We observe large improvements in accuracy at much lower computational cost, i.e. it takes less than a day to learn high-quality word vectors from a 1.6 billion words data set. Furthermore, we show that these vectors provide state-of-the-art performance on our test set for measuring syntactic and semantic word similarities.

Model

Let’s go into the details. We are going to create a neural network with a single hidden layer. In input, we will pass one hot vector representing a word and in the output, we will get a probability of that word being near the center word. This is one of that neural network where the actual goal is not the output that we get, in this case, we are interested in learning from the weights of the hidden layer. Output layer is required to decrease the loss.

skip_gram_1

Figure 1: Skip-gram predicts surrounding words given the current word.

From figure 1 we can get a basic idea of different layers in the Skip-gram model. So, there were two architectures proposed: one is Skip-gram model and the other one is the Continuous Bag-of-Words model. In the case of CBOW, we predict the center word based on context words and in the case of Skip-gram, it’s opposite. Also, it’s called the bag-of-words model as the order of words in the history does not influence the projection. In this post, we will talk about Skip-gram model.

In mathematical terms, its goal is to maximize the average log probability. Let’s say if the number of training words is T then this is the representation of average log probability:

average_log_probability

average_log_probability_explanation

softmax1

softmax_equation_description

Hidden Layer

architecture_w2v

In the above neural network architecture, you can see we have three layers and in that, we already know about the input and output layer. Let’s discuss the hidden layer in above architecture.

Hidden layer in this neural network works as a look-up table. So, let’s say if we have a one-hot vector with 1000 rows as an input and the hidden layer contains 30 features which mean a matrix of 1000 rows and 30 columns. When we multiply them then the output will be the matrix row corresponding to the 1.

Also, the features in the hidden layer can be treated as hyper-parameters which you can tune it in your application. There is no restriction, so you can try different values.

The output from the hidden layer is what we call word vectors.
We update them based on the output layer’s result.

Open source projects

If you want to use some prebuilt tools to create word representation then Facebook’s fastText is one of them.
And this is Google’s implementation of Word2Vec where they used Google news data to train the model.


on demand

Time for On Demand Services to embrace Real Time Chat

On demand services has grown from a puppy to a strong and resilient animal in less than a decade. Unique startups with the ability to adapt and customize have mushroomed across the globe. The central reason of compounding growth of this industry is the smartphones. Smartphones have allowed humans to meet their innate desire of immediacy. Mobile apps has become the primary destination to find any service, solution, information and what not! 

Today, whether you want to book a Taxi or want to book an appointment with a doctor, or maybe you are looking to get your favourite burger delivered at your doorstep, it can all happen with a few taps on your mobile screen. With the ever growing consumer and their inclination to mobile, we see new services as well as competitive ones entering the market almost everyday.

The competition is getting fierce with startups like Uber and Ola locking horns for on demand taxi booking and Grofers and Big Basket fight it out to build their stronghold as they look to build Online Super Market for consumers. For on demand medical services we have new startups like Doctor On Demand, Call Health planning for the faceoff, while established players like Practo and 1MG are bound to feel the heat.  

We are gradually getting surrounded by such apps that intends to make our life easy. These startups are bound to grow as their aim is only to make world a better place. 

Researches have estimated that more than $9.4 billion dollar has been invested since 2010 in this industry. They have highlighted that this industry has low profit margin and high labour needs. So, ability to scale up smoothly and quickly is the success mantra but scaling up under such break-neck competition requires huge investments. Hence industry experts recommend to focus on customer loyalty while executing customer acquisition plans, so that the LTV (Life time Value) of the customer justifies the initial acquisition cost. 

The general consumer of these services are extremely time sensitive and also very particular about the specifications of the deliverable. Therefore, to delight the Customer it is very essential to deliver “WHAT” they want and exactly “WHEN” they want. Thus, seamless two-way communication between the end users is important to bridge the gap. 

We spoke to a few on-demand service provider startup founders where they highlighted that they have 24×7 phone and chat support but does it solve the purpose completely? 

We figured it doesn’t as most of the founders pointed out – there still is the communication gap that ends up leaving the consumer “not so satisfied” 

Let us explain this with an example:

On-demand Food Delivery apps, are a boon to every foodie like me. Ordering your favourite pizza from the outlet of your choice and getting it delivered at your doorstep? Well, life really is beautiful. All you need to do is click a few buttons and then sit back and relax. But, what if you suddenly realize you forgot to mention about the type of cheese to be added. You drop a message to customer support who typically replies after few  minutes. Moreover, by the time, the Customer Support Executive understands your request and tries to forward your request to the Service Provider, the order is already out for delivery. The outcome is a disheartened Customer fuming over not receiving the desired variant of the pizza.

So, how to tackle this issue?
Build a Human+Bot interaction on your apps.

Let me explain –
Users interact with AI-powered bots to start with, followed by Support agents only if bots fail to understand user’s inquiry. Chatbots can handle most of the Customer Support Workflow with its Artificial Intelligence.

As for the User, the moment they realize the mistake in their order, all they need to is open up the App and key in their Order ID into the inbuilt Chat Platform – this will populate your order. Next they can directly interact with the Chatbot and make customizations as required and the same will be communicated directly, thereby saving on the time gap caused due to the traditional queuing system based Support Chat. 

Well the possibilities doesn’t end just there, it can be extended on a larger scale to most On Demand Services. Chatbots cannot only be used to make Order Corrections, but also for making fresh orders, which customers tend to find more easy and natural, rather than rummaging through multiple drop-down menus in an app.

02Chat-to-order

By integrating Applozic’s Chat Platform within your apps it is possible to enable Human-Bot interaction, via which Users of your app can directly communicate with the Chatbot at your end, and thereby ease the whole process of placing or modifying an order.  

For more such Use Cases, read our post on the Top 8 In-app Chat and Messaging Use Cases for On-Demand Marketplaces.

Let us look at one more scenario:

Lunctimes during office hours had been a real pain in the past, and employees had to resort to their office canteen for dining. But food ordering apps like Swiggy and Freshmenu have addressed the problem with technology and seamless service. While these platforms offer a large variety of cuisines and dishes to order from, which no doubt is their Core Competency, collaboration still remains an issue to be addressed. Thus a team of colleagues ordering Lunch from any of these apps, have to first migrate to some other collaboration platform like Whatsapp or any other instant messenger, to decide what to order and then come back and make the order.
The result is less loyalty towards your app and there is also a likelihood that they might find the task too tedious and either go back to the good old Office Canteen or quit making bulk orders, either way resulting in a loss for your business.
The solution is pretty simple; enable a Communication platform within your app and let users interact with one another, within the confines of your app.

This will again address two problems:

  • Increase User Engagement and Loyalty
  • Enable better Decision Making from Customer point of view.

 

This apart it also allows for crunching of Chat Data to make Custom offers via In-App Messages or Push Notifications.

We at Applozic, provide a complete solution to On – Demand service providers with our Ready – to – use Chat SDK.  

  • One – to – One Chat: Let Users chat among themselves or with the Service provider/Bots directly.
  • Push Notifications: Get instant notification about incoming messages so that you don’t miss out on even a single message.
  • Group Chat: Let your users  communicate in a group about any topic/context of their choice
  • Attachments : Allow your users to share location, photos, documents, Audio, Video etc.
  • SMS and Email Fallback: Backup in cases of no internet connectivity – messages will be sent as SMS and Email
  • Cross App Chat: Even if you have two separate applications for delivery executives and customers we integrate them to a single communication channel.
  • Tracking: Read receipts and Time Stamps allow Users to keep track of their message delivery.
  • UI Toolkit: With our fully customizable UI kit, it is possible to build the way you want, to complement your Brand Identity.

For a detailed overview of each of the above scenarios and more, read the post on the Top 8 In-app Chat and Messaging Use Cases for the On-Demand economy.

Applozic supports Web and Mobile apps be it on iOS or Android. Sign Up with us, and enable your web and mobile apps with our end-to end Communication Platform. 

Feel free to contact us at contact@applozic.com for any queries and we would be happy to help.
Help us serve you better by providing your valuable comments and feedback in the section below.


wingstop

Use Chatbots to Order Pizza Now

Want to order a Pizza?? You no longer need to call or go to restaurant’s website or use their mobile app. So, what is this new way to order Pizza then? Robots, E-mail or Fax? Nooooo!! From now on, use your Facebook or Twitter account. Yes, your food ordering experience now becomes more easy, time saving and smooth. Pizza Hut announced recently ( here ) that soon its customers can order their pizzas on Facebook and Twitter, while the chatbots helps you in the process.

It’s a good news for all foodies but the best part is, chatbots are not restricted to ordering pizza, it brings the potential to accomplish a lot more, some we may not have even imagined so far. You can ask the CNN bot to send you the links to the trending articles, ask a bot for the weather forecast..Bots based on natural language processing has the capacity to learn from each individual interaction with a human being and it only gets better with more and more interactions.

Bots ain’t the thing of future, its here and we see it on rise with likes of Pizza Hut, Whole Foods Market, Dominos, Burger King and Wingstop announcing to make it a part of their day to day operations soon. Bots are already serving as virtual assistant in Travels industry, want to try? Go here: https://taylorbot.com. Also, did I mention bots in Healthcare? Try Healthbot from TigerConnect.

Engineers across the globe are racing to build ‘bots’ or server-side agents that can interact with consumers via the various messaging channels like Slack or may be Applozic very soon.

Today, let me help you understand how you order your pizza via FB messenger or Twitter while bots are acting behind the conversation.

 

wingstop(Source: http://fortune.com/2016/06/07/wingstop-order-facebook-twitter/)

Here’s how you or your potential customers would order Pizza on FB or Twitter,

  • Feel like having pizza? tweet “order” or “#order” to the company’s Twitter handle, @company name
  • Send a direct message to the corporate page on Facebook Messenger to begin the ordering process.
  • In either case, the interaction is then handled via private conversation to complete the order.
  • Once the order is complete, its just usual, you receive your order.

Exciting and time saving? Isn’t it?

Though this still seems to be a niche category but the popularity is magnifying with each passing minute. The social ordering process would grow as the amount of time netizens spend on social media is on a rise with compounding effect. Take a look!

Slide037(Source: http://wearesocial.com/sg/wp-content/uploads/sites/9/2016/01/Slide037.png)

Conversational commerce expands the horizon of social ordering process. Real time chat (intelligent one) will save time and provide a smooth and hassle free experience for customers which in turn will build customer loyalty. Also, with expansion of internet across the globe, the probability of Chatbots tapping on new territories is increasing dramatically.

Check the exhaustive list of Chatbots here: https://www.chatbots.org

You must wondering by now how could you make one yourself, learn to make it in four simple steps.

We believe that chatbots can do great things and its potential is yet to be explored. At Applozic, We have built MQTT based native SDK’s with back-end for real time chat/messaging. You can call it “Feature-as-a-Service”for its simplicity of integration; adding just a few lines of code in your application is enough to get you started with cross platform multi device synced chat. We have started with Bots now so your ideas and suggestions are much appreciated.