 Thank you, Dr. Andrews. So wonderful evening to you. So I'm Karthik. I work for SAP Innovation Center right here across this street here. So I'll just give a brief. So in this presentation, I'll be talking about sentiment analysis, how it could be used and possibly how do we make a TensorFlow sentiment analyzer. So just a brief introduction. So I do data science research at SAP Innovation Center. So where we work on machine learning for the enterprise. So we try to have natural language processing, do image analysis at the enterprise level. And I also work with the team which actually does the machine learning, the natural language understanding part of it. I'm also currently a Google Developer Expert on machine learning. And I have other talks as well. I do some talks on images and using TensorFlow and doing on Google Cloud as well. And I'm a proud alumnus of NTU. I did my PhD at NTU and I'm working in NTU from Singapore for close to four and a half years now. And yeah, so let's move into the objectives for the evening. So in this talk, we'll be talking about sentiment analysis. What is it? Why do we care? And what is in it for us? So basically, we will talk about some of the NLP techniques, what are the challenges, and why is it so difficult to actually make an NLP say of algorithm to say. And we'll also see probably ways to improve and think about some of the challenges and how we go from here, probably from a theoretical standpoint to something on a practical level. All right. So what is sentiment? So one of the fundamental problems with human language is that we all have different ways of talking, we have different actions, we have different ways. Grammatically, we speak at different speeds. So one of the fundamental challenges is that understanding sentiment itself, the word itself has a gradient. There is no yes or no, true or false. So in this case, so the strange thing is that it works, it's basically something, so these are sentences that I took from a dataset. So this is actually quite neutral if you say, but this is actually classified as is actually positive. So something like shattered image is in complex, it's just stupid and boring. So this is obviously negative. So in this case, so there are actually a mix of words which are actually positive and negative and the entire sentence actually together brings in the actual sentiment. So in this case, it's actually, if you see the first half of the sentence is actually, it says it's stuck in the past again, but it has to do something better than the code. So here what happens is you have a mix of positive and negative, but in this case, this is a positive sentiment. So you see that sentiment itself is actually quite debatable. So what I would think is positive might not be positive to you, it might be probably neutral. So that is where the natural language processing the entire research actually goes away. So just like Dr. Andrew said, it's very difficult to actually put forward what is true and what is what. You cannot say that this is the way it has to be because in general, we have a lot of subjective understanding of certain things, and probably it's regional, it's cultural, so all these come into play when we actually talk about natural language understanding. So another example is far from bewitching, the crucible tests the patient. So things like this, it's negative, but so this is where we are actually seeing how do we solve this challenge. So why does it matter? So one of the fundamental problem is that sentiment has a big impact. So possibly one could be on stock prices. So there was a study that actually said that positive sentiment or negative sentiment could actually affect your brand value or stock prices. So for instance, Samsung took a huge hit when Galaxy S7 actually was in the news, and people are talking about it on Twitter, on Facebook, so the stock price actually took a dive. Another problem is something like you want to understand how your customers perceive your product or probably a brand. So if you go to probably eBay, you will see that there's actually a feedback about the seller, there's a feedback about the buyer. So in general, people will buy from a seller who has probably 95 percent or more, or 98 percent or more, I would generally go for someone who has a 99 percent scoring. So this is actually very important because people give a rating for the service that you've given, which means that this is a standard of quality versus trust. So in general, so I would always want, this is what is a positive sentiment here, and this has a potential to change history again. So this change history is actually pretty strong. So if you see back November 2016, so almost we had a huge change in history, and you all know what's happening right now on a daily basis. We are getting large doses of comedy and fantastic times on the news, and so this is what is going to, a sentiment actually affects a lot of industries, right from politics to electronics. So it affects almost every aspect of life. Like I said, it affects trust as a brand, as a system, as a person. So as a system, it could affect the entire government, for instance. So if there's a corruption scandal, then the government is blamed for that. So in general, sentiment is actually quite an important topic for a lot of brands and a lot of people. So this is an example. So this is an example that I said. This was in a paper, this was a study that they said how Twitter affects the stock price or how it affects the results. So in this case, if you see the trend here, so the first one is about the opinions after the day of an election, and the opinions near Thanksgiving. So these are all how actually people are, the mood of people and how people affect to a particular news or particular topic. In general, if you see that, in this case, the last is about happiness. So in general, people are happy after Thanksgiving because probably they would have got a gift or probably they would have met a family member. So people are generally via, they have some surety issues probably before an election result. So they are actually anxious about what's going to happen. So things like that affects a lot of cases, a lot of brands. So this is one of the reasons why sentiment is actually very crucial. So why is it actually hard? So to TLDR, the main reason is language. Sarcasm, for instance, lingo is another problem. So these are all bigger, the challenges that we actually face on a day-to-day basis. For example, this movie is just brilliant. Actors are first grade, but the camera work is shoddy at best. So if you see it starts off good, and then towards the end, it just tapers off and goes back to negative. So the overall sentiment could be positive. If you think about just put one plus one, and then subtract minus one. But if you see the tone of the whoever wrote this, could have been like, okay, I was okay, I was happy with it. But in the end, it was actually let down because the camera work was bad. So the overall sentiment that I have is still negative, but I just wanted to be a nice person and then I just said, okay, this is good, that's good. So this is the reason why it's actually very difficult to understand sentiment of people and come up with an algorithm that can actually solve this or give us a proper score for that. This is another example. So the film runs for a slick one 40 minutes, I was just blown away by how true Einstein was after all. So this is one shared example of how human beings have actually evolved to make sarcasm, and comedy work for us. Although we have brilliant deep learning or machine learning research that actually works for 99 percent accuracy and things like that, we cannot computer cannot understand a joke, a computer cannot understand sarcasm, a computer cannot understand emotion. So these are all areas where machine learning and in general would fail. This is where probably as humans, we will still stay alive, but still if you look at it, these are all areas where we can improve and we can understand one another, and probably a machine could actually help us if the machine was able to understand sarcasm. So this one is quite Singaporean, I was actually quite surprised to see this on the dataset. So this was actually on the dataset. This is actually, I think this was probably negative, but I think this is positive in that sense, but you see what we are saying. So there was a question about what happens to punctuation or probably what happens to the numbers or things like that. But if you see in this case very short, so the person that you're talking about very short is V-short. So these are all the lingo that we use, is going to be cultural, and if you see OKLR, I double-check with the hard drive. So these are things that will actually evolve only when you actually understand the local context, and that is why if you see why Google is having probably a region-level Twitter trend, or region-level data analytics is because all these are very cultural. So data collection on a cultural level on a regional level becomes important because you would not be able to understand people's sentiment or people what people are saying, if you're just doing a global data collection. So and this is the reason why most of our algorithms would fail. Because humans are ingenuous in actually making, we just come up with new words, another person could actually understand, but a computer would find it very, very difficult because it has never encountered those words before. So yeah, so that's some of the reasons and some of the challenges straight out of the bad. So one of the reasons or what is sentiment analysis? As a simplest, we could actually say that this is to probably find the attitude, is it positive or negative? Probably then more complex is rank the attitude between one to 10, and another is advanced is probably identify all the aspects, and then give individual scoring for all the aspects, whether they are positive or negative, or probably in between neutral. So one of the biggest challenges is coming up with an overall sentiment score, that becomes an all the more even more challenge. One of the biggest topics again in sentiment analysis that we often encounter is handling negation. So in this example, we see, I really didn't like the food here versus I really like the food here. So just adding one word in between here, completely changes the sentiment here. If I said, so how do we differentiate this? So how do we understand that this word in between is going to change the sentiment? So this is another big area where we want to see which parts of the words are useful. What are the words? So is it probably just the adjectives or probably all the words? An experimental evidence shows that in most times, all the words actually are useful. What about word occurrence versus word frequency? For example, if I had said that this food is amazing, the word amazing is actually quite useful in this context to show the sentiment. But if I actually said amazing like 25 times, it makes no difference because it's actually it's not going to give me additional data, additional input about how happy I am, but it's only going to show that I am the overall sentiment is again positive. So it's not going to change the fact that there was one occurrence for useful versus 25 occurrence of useful, it's not going to change the overall sentiment. So that is where another area is what do we give importance to? Is it word occurrence versus word frequency? So in general, we would do both, but in sentiment analysis, we would actually give importance to word occurrence more. All right. So one more thing is a friendliness detection. So this is one thing where another gray area, so that's actually important for analysis. So in some cases, you would say, oh, that must be hard on you. Sorry to hear that it didn't go well. So things like this are, it's very humane. So we cannot actually make a data set out of this, and then we cannot come up with something that could add a gradient to what the sentiment is. But this is still another important area, because if you want to analyze, say sentiment on Facebook, if someone is feeling say suicidal, then we would still want to know how this person, how to help this person. So this could be another area why text understanding is all the more important. So if someone actually writes something on Facebook, if it is going to be positive or negative, so the emotion, so all these contribute a lot of importance. So some ways to improve the sentiment detection is, we could probably say, so grouping words that actually co-occur. In general, brilliant was probably an example that actually occurs with positive, or amazing is actually an example of a word that could actually occur with a positive sentiment. Another example would be say poor. Poor generally occurs probably with negative sentiment. So I would say this, the camera work was poor or the lighting was bad. So things like these, so understanding co-occurrences of words help a lot, and representation of words become all the more important. So Dr. Andrews actually showed us about word-to-wek, or word embeddings. In this case, so an example of word-to-wek was basically, man is to woman, is king is to work, is like queen. So in the same case, understanding these semantic relationships would become important because the way in which words occur, you can actually see what are the words that are close by to bring the sentiment there. So you can actually say, even though I might not understand a word, if I can understand its neighbors, I can actually understand what the word is talking about. So this is another example of how we could actually improve sentiment, and probably again analyzing the polarity of the words in the sentence itself is another way we can actually improve the sentiment itself. Here the movie began on a brilliant note, but failed to live up to expectation in the end is basically the way in which if you can understand give importance to words and sentiment of these words separately, instead of giving an overall sentiment, then that would also be useful. And finally, if we could understand the importance of words, so that is actually another important area. So this is what we call attention. So in general, if we have a sentence, this attention was actually from images. So in images, you have regions of attention that these are actually visually attentive regions, which actually the eyes are attracted to. So in text, we've actually adapted this to text as well. So if you can understand what are the most important words for this example, this was a day that started off on a great note, but there were moments when I thought I was falling asleep until I saw the mouse chase the cat of the house. So the surprise element is towards the end. So all the other words are more or less boring, but if you see the attention span would be at the end where the mouse is actually chasing the cat out of the house. So the attention is actually more important again in sentiment. So if you can give words, weights based on attention, then that would also be very useful for doing sentiment analysis. So where do we go from here? So one point that's actually very useful as understanding words and how are the words related to one another? So for example, there's a word net from Princeton that actually gives semantic distance between words. So just like how we saw the word embeddings on the TensorBoard, we can actually do something similar to that, but this is more semantic distance from, for example, red is a color, and so the distance between red and color would be at a semantic level. So there's all reds are colors, all greens are colors, so the distance between red and green would be the distance to a color. So effectively, that's something what wordnet would give. But again, wordnet would fail in cases where new words are not there that cannot be semantically mapped. So what we can do is we can use something like word vectors. So word vectors, word embeddings from probably word to egg or glow would give us this embedding. So I'll show you what exactly what Dr. Andrews also showed. I have some example of the code that I actually ran here. So this can be done for any sort of word. So you can actually take a small corpus of words, and then if you have like say a thousand lines, oops, I'm doing it on the wrong page. Yeah. So this word, so this is something like you can take some random text, some log of text, and then you can put it to, you can write it and so this is a small program that you can write to understand how words are occurring with one another. So what word to egg is doing is basically trying to understand the context of a word from its previous and its next word. So effectively, what it's doing is, it's an unsupervised method wherein you would give no labels. So effectively, what word to egg says that, okay, you have I live in France, I speak something. So there's something would be based on the fact that there's a previous of speak and the next is tomorrow or something like that. So the point is it's trying to bring the context of the word from an earlier context and the next context. So I think this code is available on my GitHub. So you can actually go to this page and then you can go to my GitHub and you can get this code as well. Another example would be something like this. The reason why sentiment is good for, if you have a word embedding is because just like how Dr. Andrews showed, we can actually search for simple words and we can actually figure out what are the closest words here. So effectively, if I can do on a tensor board, I can actually select something like this, and I can see what are the words that are actually close in that selection. This will actually give a group of words that are actually close to one another, and that will also help us and do more analysis on what are the words that could actually. So in this example that I gave, like for example, if poor and say bad and ugly. So these are all words that could actually co-occur, and if you actually put them on the embedding space, they could all be cluster to on a similar space there. So that's how word-to-vec or Glock could give us help. Another thing is skip thoughts. Skip thoughts is another very interesting idea. So just like how word-to-vec is working on the word level, skip thoughts does the same on a sentence level. So effectively, it can actually predict sentences or the context of sentences from its earlier sentence and the next sentence, and then it can actually contextualize a sentence, and this is again very, very interesting. So we could actually do something like a skip thoughts to understand what the sentence is talking about or do a further analysis on the text. Effectively, what we are trying to do here is either train a classifier or a regression, and we are trying to predict in the classifier, we'll say it's a positive or a negative sentiment. With the regression, we would give it a scale of say one to five or one to 10, and we would say that okay, so this is a neutral, is it positive or negative, things like that. One more thing is like I said, it's good to understand what attention is, how it will help. So if we can bring out all the important words, we can actually say whether this word is probably into some class and how we can actually classify the overall sentence and the sentiment together. Yeah, so there's one very, very cool unsupervised sentiment neuron. So this is a topic, a research that was actually published by OpenAI. So they have only 4096 sentiment neurons that actually do complete. So this is an unsupervised paper. So what you can do is you can, this program I actually learned from over one month of training, and it is capable of doing. So on the Pantry Bank, it can actually do a close to 92 percent sentiment analysis, and actually it can actually classify words on the sentiment tree bank. So you can check this out. So this is actually a very cool, very interesting paper, and I think even the code is available. So if you want to do some sort of sentiment or a feature extraction, you can actually do from the unsupervised sentiment neuron as well. So this is again on TensorFlow. So I have built a sentiment classifier. So in case you're looking at ways to either build a classifier or you want to try something on a logistic or a regression model, you can actually check out my GitHub repository as well. So yeah, so a possible workflow, something that I took from a paper here would be something similar to what Dr. Andrews showed earlier. We could do a text extraction and then train a sentiment classification and then extract aspects out of those trained class of sentiments, and then finally aggregate those and then provide a final summary of the actual sentiment. So this is a possible workflow that could be followed. So this is also followed in general when you actually build a large-scale sentiment analysis engine. Thank you. If you have any questions, let me know.