Why we Need Emotion Detection
In our daily life, we go through different situations and develop a feeling about it. Emotion is a strong feeling about a human’s situation or relation with others. These feelings and express Emotion is expressed as facial expression. The primary emotion levels are of six types namely; Love, Joy, Anger, Sadness, Fear, and Surprise. Human expresses emotion in different ways including facial expression, speech, gestures/actions, and written text. This article mainly focuses on two expressions namely; written text and speech.
As technology progresses, the internet is now commonly used on PCs, tablets, and smartphones. This generates a huge amount of data, especially textual data. It has become impossible to manually analyze all the data for a specific purpose. New research directions have emerged from automatic data analysis like automatic emotion analysis. Emotion analysis has attracted researchers’ attention because of its applications in different fields. For example, security agencies can track emails/messages/blogs, etc., and detect suspicious activities.
The business communities nowadays prefer to use emotional marketing. In emotional marketing, they try to stimulate customers’ emotions to buy products or services. Some emotional marketing advertisements’ are given at the link .
Text Analysis Techniques: First Step Towards Text to Emotion
In order to predict emotion from a given text, it is first analyzed to get the base forms of words. The following Natural Language Processing (NLP) tasks are performed mainly during the process;
- Parts of speech
- Frequency of words
- Numeric quantities
- Structure of the sentences
- Nouns referring to entities
For this purpose, we can use Stanford CoreNLP  APIs. The combination of NLP tools and algorithms can identify the emotion in binary outputs. Binary outputs are sometimes called bipolar results. Examples of bipolar outputs are positive/negative or Good/Bad or Like/Dislike etc. The words are treated in isolation and classified as one value or another. The aggregation of the positive and negative points is then used to decide on one of the binary outputs. Here, it ignores the word order in a sentence which loses vital contextual information.
This approach may perform well where the algorithm analyzes only simple text only. However, it may find it difficult to analyze texts which contain complex sentences. Another drawback of this approach is that it cannot quantify the level of emotion.
Emotion Detection from Text Using Deep Learning
Katz et al.  proposed the SWAT system where they mapped the words and each scored each word according to multiple labels. Such classifications are essential for designing detection techniques and algorithms. These algorithms perform two steps for selecting input words. First, it classifies the words into features, and second, it eliminates the dimensions. This is a conventional method and not an optimal technique.
The reason is that it is difficult to train the machine for complex sentences. Consider the sentences as an example; “I am happy” and “I am not happy”. Using conventional methods, it is difficult to differentiate between the two sentences.
Deep learning allows techniques that understand the semantics and structure of the sentences. The algorithm for deep learning may represent the entire sentence. The representation is based on the words’ arrangements and their interdependencies. RNN  represent the words as vectors and an operator as a matrix. Therefore, it is the best choice for implementing deep learning.
In this case, for a sentence like “I am not happy”, the word “not” works as a rotation matrix. Then, the rotation matrix will act on the next word which is “happy”. This process will change the polarity and the sentence will be semantically correct. One of the drawbacks of such systems is that it requires intensive training. To deal with the short memory problem in RNNs, the technique (Long Short Term Memory) LSTM is used as proposed by .
Domain Adaptation for Sentiment Classification using Deep Learning
Hadi Pouransari and Saman Ghili  used a similar technique for sentiment analysis. They implemented and tested their techniques for movie reviews. For training the data they used low-rank RNN to get a faster response. Similarly, Glorot, Xavier et al.  used deep learning for domain adaptation. Their results were convincing on large-scale sentiment analysis for domain adaptation. The main reasons for using the deep learning algorithm were;
- They aim to extract those features which disentangle the hidden factors of variations. This will help to perform the transfer across different domains. In this case, they were expecting the concept which characterized the review.
- They considered some of the factors like positive reviews to check the disentanglement of the dataset.
- To compare the overall improvement in domain adaptation by using a deep learning algorithm.
The authors considered unlabeled data from different and labels from a single domain. They followed a two-step procedure for sentiment analysis. The proposed algorithm learns the higher level features extraction in an unsupervised fashion. This learning is from the reviews belonging to a different domain.
For this purpose, the authors used Stacked Denoising Autoencoder (SDA). The non-linearity of the decoder was logistic sigmoid function and the corruption process was the noise. The criteria for training consider the Kullback-Liebler divergence. The algorithm allows adding squared error and Gaussian corruption noise for reconstruction error criteria. Its aim is to rectify the nor-linearity of the input layer.
The code layer activations at various depths defined fresh representations. For this purpose, the algorithm trains the linear classifier on transformed labeled data. It uses Linear SVM with squared hinge loss for classification. The results show that the protocol outperformed other existing techniques in domain adaptation analysis.
Emotion and Text Analysis Software Tools and Platforms
- CrowdFlower: Users can train their machine learning algorithms with CrowdFlower. It can analyze complex text for non-binary outputs .
- Lexalytics: it uses a large corpus of text from the web via an internet search engine. The corpus is compared to evaluate the nearness of known words to the target phrase. Lexalytics provides many types of sentiment analysis solutions. It also offers APIs for integration into the client’s own products [8, 9].
- Google Cloud Prediction APIs: It provides machine learning capabilities and pattern matching. It learns from the data and predicts the new value. A step-by-step guide is given at the web link in .
- Google Cloud Machine Learning: It provides a platform to easily build scalable machine learning models of any size .
- Cloud Natural Language API: It parses the structure and meaning of the text by machine learning models .
- Brandwatch: An online sentiment analysis system that is based on machine learning .
- Algorithmia: Provide detailed analysis of different types of data. Algorithmia is working on many algorithms and compare the performances. Their detailed analysis is available on the website . Another useful initiative “Introducing Cloud Hosted Deep Learning Models” by Algorithmia .
There are many tools for implementing deep learning algorithms and codes. For details please visit the website .
- Feature extraction plays an important role in emotion analysis.
- NLP techniques can be used for text feature extractions. The use of lexical databases like WordNet can provide detailed features.
- The bipolar analysis doesn’t need detailed feature extractions.
- Non-binary analysis is a complex task to perform. It needs detailed feature extractions along with a machine learning system. Deep learning is well suited because it can learn the features and interrelationships of the features.
- P. Katz, M. Singleton, R. Wicentowski, SWAT-MP: the semEval-2007 systems for task 5 and task 14. Proceedings of the 4th international workshop on semantic evaluations, ACL (2007), pp. 308–313
- Hong, James, and Michael Fang. “Sentiment Analysis with Deeply Learned Distributed Representations of Variable Length Texts.”
- Pouransari, Hadi, and Saman Ghili. “Deep learning for sentiment analysis of movie reviews.” (2014).
- Glorot, Xavier, Antoine Bordes, and Yoshua Bengio. “Domain adaptation for large-scale sentiment classification: A deep learning approach.” InProceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 513-520. 2011.
- Literally Arousing – 15 Examples of Emotional Marketing