How AI does sentiment classification

AI & Customer Intelligence

background_image background_image

Artificial intelligence (AI) are systems that can perform tasks that typically require human intelligence.

AI is mostly pattern recognition.

Here’s a simple thought exercise that illustrates how AI models are built. Suppose that we are trying to build an AI sentiment classifier that can distinguish between positive and negative comments. As humans, we just read them, and it’s obvious “Thanks for the great app!” is positive and “Your app is terrible!” is negative. But how would a computer do that same task?

#1 - How AI does sentiment classification

A computer could start with the two sentences, and create a dictionary of all unique words that are not filler words like “for” or “the”. It could then determine which word in the dictionary show up in each sentence. Using human-provided labels that the first sentence is positive and the second sentence is negative, a computer can use a learning algorithm to calculate how predictive each word in the dictionary is of the overall sentence being positive or negative. So in this example:

  • App shows up equally often in positive and negative sentences, so it’s neutral.
  • Great only shows up in the positive sentence, so it’s positive.
  • Terrible only shows up in the negative sentence, so it’s negative.
  • Thanks only shows up in the positive sentence, so it’s positive.

#2 - How AI does sentiment classification

A basic model could be to make each positive word be worth +1, each neutral word be 0, and each negative word be worth -1. Then the first sentence would be +2, which is positive, and the second sentence would be -1, which is negative.

Now, imagine instead of having two sentences, humans provide hundreds or thousands of examples of positive and negative sentences. The learning algorithm crunches all this data to figure out how predictive each word is of positive or negative sentiment. And that generates a model, which is a mathematical equation that can assign any sentence a sentiment score.

Up to this point, we’ve been talking about sentiment classification, but the same approach works for many other tasks, such as translations. To build an AI translator, we can feed a model many pairs of English statements and their French translations, and the generate a machine translation model.

#4 - How AI does sentiment classification

And this same method can be used to build an issue classifier that identifies the topic of a piece of unstructured text. Idiomatic builds custom issue classifiers for each business so to capture each company’s unique business context.

#6 - How AI does sentiment classification

Also, often times people say “sentiment” and they really mean topic modeling as in “what does the text mean” vs. “whether the text is positive in tone of voice or not”. Therefore, we advise our clients to precisely define what they mean by “sentiment” before applying AI to solve their problem or answer their question.

If you’d like to learn how we at Idiomatic do sentiment analysis, please watch the video below where our co-founder Chris explains it. If you’d like to learn more, request a no-obligation demo today.

Request demo