Emotion Detection Using Machine Learning

emotion detection
Pulling out context from the text is one of the most remarkable procurements obtained using NLP. A few years back, context extraction was to detect the sentiment from the text and then the definition took a step forward towards emotion detection. These two are very different terms. The sentiment can be positive, negative, neutral while emotions are more refined categories among these three. A positive sentiment could be attributed to happy, excited and even a funny emotion. Similarly, anger, disgust, and sad emotions make the sentiment negative.

Machine Learning in Emotion Recognition

Emotion from the surface of it does not look like a very direct problem. Most datasets are labeled as Valence – Arousal scores to capture emotion. A lot of feature engineering was involved in training these algorithms earlier. Here is what this scale looks like:

emotion scale

Until 5 years back, training classifiers for emotion would have involved making emotion word lists, deciding what features to use to classify and then train an SVM or Maxent Classifier. However, all this feature engineering is slowly becoming a thing of past given the new trend of Deep learning, which can do feature extractions automatically. That is how we have built our Emotion Classifier at ParallelDots. Deep Learning just makes all these complications go away and converts the problem into a simple classification/regression problem depending on what exactly you want to predict. It’s that simple now.

How we do it
  • Create a dataset of emotions. Take this one for instance. At ParallelDots, we have our own data tagging team which created a customized emotion dataset for us to train algorithm on.
  • The tagged dataset is then fed to the neural network which is trained accordingly.
Choice of Neural Network
  • With the recent developments in Deep Learning, there are multiple options we have in implementing algorithms.
  • Convolutional Neural Networks (Convnets) and Recurrent Neural Networks (RNN) are two options any Data Scientist has while solving text classification problem. A very good review of approaches is given here.
  • Effectively the point is the longer context you need, you use an RNN, and feature detection tasks can be done by Convnets. Please note that there can exceptions to this rule as discussed here.
  • We ended up with using Convolutional Neural Networks for implementing Emotion Classification as it is a feature detection type of task.

After training the neural network until we reach a creditable accuracy, we generate emotion output for our analytics reports. You can check out the guide to our AI analytics report here.

emotion detection

Emotion Detection: The Present and The Future

Emotion detection technology is making a huge difference in how we leverage text analysis. Especially, in the field of marketing. Detecting emotions, to a major extent can determine the success or failure of a campaign. In the next article, we will discuss how emotion recognition is helping the marketers and what future possibilities could be explored with this technology.


Follow Me