Venue: NAACL 2018

# Relevant Emotion Ranking from Text Constrained with Emotion Relationships

Deyu Zhou\({}^{\dagger}\) Yang Yang\({}^{\dagger}\) Yulan He\({}^{\lx@sectionsign}\)

\({}^{\dagger}\) School of Computer Science and Engineering, Key Laboratory of Computer Network

and Information Integration, Ministry of Education, Southeast University, China

\({}^{\lx@sectionsign}\) School of Engineering and Applied Science, Aston University, UK

{d.zhou,yyang}@seu.edu.cn, y.he@cantab.net

###### Abstract

Text might contain or invoke multiple emotions with varying intensities. As such, emotion detection, to predict multiple emotions associated with a given text, can be cast into a multi-label classification problem. We would like to go one step further so that a ranked list of relevant emotions are generated where top ranked emotions are more intensely associated with text compared to lower ranked emotions, whereas the rankings of irrelevant emotions are not important. A novel framework of relevant emotion ranking is proposed to tackle the problem. In the framework, the objective loss function is designed elaborately so that both emotion prediction and rankings of only relevant emotions can be achieved. Moreover, we observe that some emotions co-occur more often while other emotions rarely coexist. Such information is incorporated into the framework as constraints to improve the accuracy of emotion detection. Experimental results on two real-world corpora show that the proposed framework can effectively deal with emotion detection and performs remarkably better than the state-of-the-art emotion detection approaches and multi-label learning methods.

## 1 Introduction

With the growing prosperity of Web 2.0, people tend to share their feelings, attitudes and opinions through the social platforms such as online news sites, blogs. Detecting emotions from texts can enhance the understanding of users' emotional states, which is useful in many downstream applications, such as human-computer interaction and personalized recommendation. Therefore, it is crucial to analyze and predict emotions from text accurately Picard and Picard (1997).

Research on emotion detection can be roughly categorized into two types: lexicon-based and learning-based approaches. Lexicon-based approaches usually rely on emotion lexicons Lei et al. (2014); Rao et al. (2012). They cannot deal with text when words can't be found in emotion lexicons. Learning-based approaches can be furthered classified into unsupervised and supervised learning methods. Unsupervised approaches do not require annotated data for training. For example, by adding an emotion layer into traditional topic models, emotion-topic models were constructed to detect users' emotions Bao et al. (2012, 2009). Supervised learning approaches consider each emotion category as a class label and emotion detection is cast as a classification problem. If only choosing the strongest emotion as the emotion label for a given text, emotion detection is essentially a single-label classification problem Lin et al. (2008); Quan et al. (2015). To predict multiple emotions simultaneously, emotion detection can be solved in the multi-label classification framework Bhowmick (2009). Moreover, to predict both multiple emotions and their intensities, some approaches have been proposed using emotion distribution learning Zhou et al. (2016). Some lexicon-based approaches such as Wang and Pal (2015) can also output multiple emotions with intensities using non-negative matrix factorization.

In this paper, we are interested in exploring e-motion ranking from either readers' perspective or writers' perspective in two different real-world corpora. In both cases, a given text is associated with multiple emotions. For example, Figure 1 illustrates an online news article crawled from Sina News _Society_ Channel together with readers' emotion votes. It can be observed that when reading the news article, readers expressed differen-t emotions with the majority showed "_Sadness_" and "_Anger_". We notice that some emotions such as "_Touching_", "_Curiosity_" and "_Amusement_" on

ly received 1 to 3 votes. In comparison to the total number of votes received, these votes could be considered as outliers or irrelevances. Also, the extremely low emotion votes might be due to readers' clicking errors. Taking into account such e-motions during the learning process could introduce bias. Therefore, we aim to differentiate relevant emotions from irrelevant ones and only learn the rankings of relevant emotions while neglecting the irrelevant ones.

Our work makes the following contributions:

* We propose a novel framework based on relevant emotion ranking to identify multiple e-motions and produce the rankings of relevant emotions from text. In the framework, the objective emotion loss function is designed elaborately so that both emotion prediction and rankings for only relevant emotions are achieved without being affected by irrelevant ones. To the best of our knowledge, it is the first attempt to perform emotion detection and relevant emotion ranking at the same time.
* As some emotions co-occur more often while others rarely co-exist, the prior knowledge of emotion relationships is incorporated into the framework as a constraint. Such emotion relationship can provide important cues for e-motion detection.
* Experimental results on two real-world corpora show that the proposed framework can effectively deal with the emotion detection problem and performs better than the state-of-the-art emotion detection methods and multi-label learning methods.

## 2 Related work

Emotion detection is one of the subfields of sentiment analysis where emotions are more fine-grained and expressive. In general, emotion detection approaches can be categorized into two types: lexicon-based and learning-based approaches.

Lexicon-based approaches usually rely on emotion lexicons consisting of words and their corresponding emotion labels. For example, Aman and Szpakowicz (2007) classified emotional and non-emotional sentences with a predefined emotion lexicon. Emotional dictionaries could also be constructed from training corpora of news articles and be used to predict the readers' emotion of a new articles Lei et al. (2014); Rao et al. (2012). Agrawal and An (2012) proposed a context-based approach to detect emotions from text at sentence level. An emotion vector for each potential affect bearing word based on the semantic relation between emotion concepts and words was generated. The emotion vector was then tuned based on the syntactic dependencies within a sentence structure. Other lexicon-based approach such as Wang and Pal (2015) can also output multiple emotions with intensities using non-negative matrix factorization with constraints derived based on an emotion lexicon.

Learning-based approaches can be further categorical as unsupervised and supervised learning methods. Unsupervised learning approaches do not require labelled data for training. For example, the emotion-topic models Bao et al. (2012) were proposed by adding an extra emotion layer into traditional topic models such as Latent Dirichlet Allocation Blei et al. (2003), thus capturing the generation of both emotion and text at the same time.

Supervised learning approaches typically cast emotion detection as a classification problem by considering each emotion category as a class label. If only choosing the strongest emotion as the label for a given text, emotion detection is essentially a single-label classification problem. Lin et al. (2008) studied the classification of news articles into different categories based on reader-s' emotions with various combinations of feature sets. Strapparava and Mihalcea (2008) proposed several knowledge-based and corpus-based methods for emotion classification. Quan et al. (2015) proposed a logistic regression model with emotion dependency for emotion detection. Latent vari

Figure 1: An example of an online news article from Sina _Society_ Channel with voted emotions.

 

ables were introduced to model the latent structure of input text. To predict multiple emotions simultaneously, emotion detection can be solved using multi-label classification. Bhowmick (2009) presented a method for classifying news sentences into multiple emotion categories using an ensemble based multi-label classification technique. Zhou et al. (2016) proposed a novel approach based on emotion distribution learning to predict multiple emotions with different intensities in a single sentence.

## 3 Methodology

Assuming a set of \(T\) emotions \(E=\{e_{1},e_{2},...e_{T}\}\) and a set of \(n\) instances \(X=\{x_{1},x_{2},x_{3},...,x_{n}\}\), each instance \(x_{i}\in\mathbb{R}^{d}\) is associated with a ranked list of its relevant emotions \(R_{i}\subseteq E\) and also a list of irrelevant emotions \(\overline{R_{i}}=E-R_{i}\). Relevant emotion ranking aims to learn a score function \(\mathbf{g}(x_{i})=[g_{1}(x_{i}),...,g_{T}(x_{i})]\) assigning a score \(g_{t}(x_{i})\) to each emotion \(e_{t},(t\in\{1,...,T\})\). As mentioned before, it is unnecessary to consider the rankings of irrelevant emotions since they might introduce errors into the model during the learning process. In order to differentiate relevant emotions from irrelevant ones, we need to define a threshold \(g_{\Theta}(x)\) which could be simply set to 0 or learned from data (Furnkranz et al., 2008). Those emotions with scores lower than the threshold will be considered as irrelevant and hence discarded. The identification of relevant emotions and their ranking can be obtained simultaneously according to their scores assigned by the ranking function \(\mathbf{g}\). Here, the predicted relevant emotions of instance \(x_{i}\) are denoted as \(\hat{R}_{i}=\{e_{t}\in E|g_{t}(x_{i}){>}g_{\Theta}(x_{i})\}\).

### Emotion Loss Function

The goal of relevant emotion ranking is to learn the parameter of the ranking function \(\mathbf{g}\). Without loss of generality, we assume that \(\mathbf{g}\) are linear models, i.e., \(g_{t}(x_{i})=w_{t}^{\intercal}\cdot x_{i}\), \(t\in\{1,2,3,...,T\}\cup\{\Theta\}\), where \(\Theta\) denotes the threshold. Relevant emotion ranking can be regarded as a special case of multi-label learning. Several evaluation criteria typically used in multi-label learning can also be used to measure the ranking function's ability of distinguishing relevant emotions from irrelevant ones, such as hamming loss, one error, coverage, ranking loss, and average precision as suggested in (Zhang and Zhou, 2014). However, these multi-label criteria cannot meet our requirement exactly as none of them considers the ranking among emotions which are considered relevant. Therefore, by incorporating PRO loss (Xu et al., 2013), the loss function for the instance \(x_{i}\) is defined as follows:

\[L(x_{i},R_{i},\prec,\mathbf{g})=\sum_{e_{t}\in R_{i}\cup\{\Theta\}}\sum_{e_{ s}\in\prec(e_{t})}\frac{1}{norm_{t,s}}l_{t,s} \tag{1}\]

where \(e_{t}\) refers to the emotion belonging to relevant emotion set \(R_{i}\) or the threshold \(\Theta\) of instance \(x_{i}\) while \(e_{s}\) refers to the emotion which is less relevant than \(e_{t}\) denoted as \(\prec\). Thus, \((e_{t},e_{s})\) represents four types of emotion pairs: i.e., _(relevant, relevant)_, (_relevant, irrelevant_), (_relevant, threshold_), and (_threshold, irrelevant_). The normalization term \(norm_{t,s}\) is used to balance those four types of emotion pairs to avoid dominated terms by their respective set sizes. The set sizes of the four different types of emotion pairs mentioned above are \(|R_{i}|\times(|R_{i}|-1)/2\), \(|R_{i}|\times|\overline{R_{i}}|\), \(|R_{i}|\), and \(|\overline{R_{i}}|\), respectively. Here, \(l_{t,s}\) refers to a modified 0-1 error. Specifically,

\[l_{t,s}=\begin{cases}1,&g_{t}(x_{i})<g_{s}(x_{i})\\ \frac{1}{2},&g_{t}(x_{i})=g_{s}(x_{i})\\ 0,&\text{otherwise}\end{cases}\]

Note that \(l_{t,s}\) is non-convex and difficult to optimize. Thus, a large margin surrogate convex loss (Vapnik and Vapnik, 1998) implemented in hinge form is used instead as follows:

\[\begin{split}\hat{L}(x_{i},& R_{i},\prec,\mathbf{g})= \sum_{e_{t}\in R_{i}\cup\{\Theta\}}\sum_{e_{s}\in\prec(e_{t})}\\ &\quad\frac{1}{norm_{t,s}}(1+g_{s}(x_{i})-g_{t}(x_{i}))_{+}\end{split} \tag{2}\]

where \((u)_{+}=\max\{0,u\}\).

However, Eq. 2 ignores the relationships between different emotions. As mentioned in Introduction section, some emotions often co-occur such as "_joy_" and "_love_" while some rarely coexist such as "_joy_" and "_anger_". Such relationship information among emotions can provide important clues for emotion ranking. Therefore, we incorporate this information into the emotion loss function as constraints. The objective functio 

\(\hat{L}(x_{i},R_{i},\prec,\mathbf{g})\) can be redefined as:

\[\begin{split}&\hat{L_{\omega}}(x_{i},R_{i},\prec,\mathbf{g})= \sum_{e_{t}\in R_{i}\cup\{\Theta\}}\sum_{e_{s}\in\prec(e_{t})}\frac{1}{norm_{ t,s}}\times\\ &(1+g_{s}(x_{i})-g_{t}(x_{i})+\omega_{ts}(w_{t}-w_{s}))_{+}\end{split} \tag{3}\]

where the weight \(\omega_{ts}\) models the relationship between the _t_-th emotion and the _s_-th emotion in the emotion set and can be calculated in multiple ways. Since the Pearson correlation coefficient [20] is the most familiar measure of relationship between two variables, we use it to measure the relationship of two emotions using their original emotion scores across each corpus.

From the above, it can be observed that the goal of relevant emotion ranking can be achieved through predicting an accurate relevant emotion set as well as the ranking of relevant emotions.

### Relevant Emotion Ranking

After defining an appropriate loss function, we need to define a way to minimize the empirical error measured by the appropriate loss function and at the same time to control the complexity of the resulting model. It can be done by introducing a maximum margin strategy and regularization to deal with emotion ranking data, where a set of linear classifiers are optimized to minimize the emotion loss function mentioned before while having a large margin. We could potentially use an approach based on a label ranking method [45]. It is worth mentioning that the margin of the _relevant, relevant)_ label pair needs to be dealt with carefully, which is not considered in [46].

The learning procedure of relevant emotion ranking (RER) is illustrated in Figure 2. The big rectangular dash line boxes denoted by \(x_{1}\) to \(x_{n}\) represent \(n\) instances in the training set. In each small box, \(e_{i},i\in\{1,...T\}\cup\{\Theta\}\) represents an emotion of the instance where the shaded small boxes represent the relevant emotions while the dashed small boxes represent irrelevant ones and the last one \(e_{\Theta}\) is the threshold. Each emotion's corresponding weight vector is \(w_{i}\). We use \(m_{t,s}\) to represents the margin between label \(e_{t}\) and \(e_{s}\). There are four types of emotion pairs' margins in total, i.e., _(relevant, relevant)_, _(relevant, irrelevant)_, _(relevant, threshold)_, and _(threshold, irrelevant)_. Different types of emotion pairs' margins are denoted using different text/line colors. For each training instance \(x_{i}\), \(margin(x_{i})\) represents the margin of instance \(x_{i}\) which can be obtained by taking the minimum margin of all its possible label pairs \(m_{t,s}\). Similarly, the margin of the learning system \(margin(learningsystem)\) can be obtained by taking the minimum margin of all the training instances. By maximizing the margin of the learning system, the weight vector of each e-motion can be derived from which the predicted emotion set and the ranking of relevant emotions can be obtained.

The learning system is composed of \(T+1\) linear classifiers \([w_{1};...;w_{T};w_{\Theta}]\) with one classifier for each emotion label and the threshold, where \(w_{t},t\in\{1,...T\}\cup\{\Theta\}\) is the weight vector for the \(t\)-th classifier of emotion \(e_{t}\). For a training instance \(x_{i}\) and its corresponding emotion label set \(E_{i}\), the learning system's margin on instance \(x_{i}\) is defined as follows by considering its ranking ability on \(x_{i}\)'s four types of emotion pairs, i.e., _(relevant, relevant)_, _(relevant, irrelevant)_, and _(threshold, irrelevant)_:

\[\min_{e_{t}\in R_{i}\cup\{\Theta\},e_{s}\in<(e_{t})}\frac{\langle w_{t}-w_{ s},x_{i}\rangle}{||w_{t}-w_{s}||} \tag{4}\]

Here, \(\langle u,v\rangle\) returns the inner product \(u^{\top}v\). For each emotion pair \((e_{t},e_{s})\), its discrimination boundary corresponds to the hyperplane \(\langle w_{t}-w_{s},x_{i}\rangle=0\). Therefore, Eq. 4 returns the minimum value as the margin on instance \(x_{i}\). The margin on the whole training set \(G\) can be calculated as follows:

\[\min_{x_{i}\in G}\min_{e_{t}\in R_{i}\cup\{\Theta\},e_{s}\in\prec(e_{t})} \frac{\langle w_{t}-w_{s},x_{i}\rangle}{||w_{t}-w_{s}||} \tag{5}\]

If the learning algorithm is capable of properly ranking the four types of label pairs for each training instance, Eq. 5 will return a positive margin. In this ideal case, the final goal is to maximize the margin in Eq. 5:

\[\max_{w_{j}}\min_{x_{i}\in G}\min_{e_{t}\in R_{i}\cup\{\Theta\},e_{s}\in \prec(e_{t})}\frac{1}{||w_{t}-w_{s}||}\] (6) 

Suppose we have sufficient training examples such that for each label pair \((e_{t},e_{s})\), there exists \(x_{i}\in G\)satisfying \(e_{t}\in R_{i}\cup\left\{\Theta\right\},e_{s}\in\prec(e_{t})\). Thus, the objective in Eq.6 becomes equivalent to \(\max_{w_{j}}\min_{1\leq s<t\leq T+1}\frac{1}{||w_{t}-w_{j}||}\) and can be rewritten as \(\min_{w_{j}}\max_{1\leq s<t\leq T+1}||w_{t}-w_{s}||\).

Moreover, to overcome the complexity brought in by the max operator, the objective of the optimization problem can be re-written by approximating the max operator with the sum operator. Thus, the objective of Eq. 6 can be transformed as:

\[\begin{split}&\min_{w_{j}}\sum_{t=1}^{T+1}||w_{t}||^{2}\\ & s.t.~{}\langle w_{t}-w_{s},x_{i}\rangle\geq 1,1\leq i\leq n,\\ & 1\leq j\leq T+1,e_{t}\in R_{i}\cup\left\{\Theta\right\},e_{s} \in\prec(e_{t})\end{split} \tag{7}\]

To accommodate real-world scenarios where constraints in Eq. 7 can not be fully satisfied, s-lack variables can be incorporated into the objective function:

\[\begin{split}&\min_{w_{j},\xi_{its}}\sum_{t=1}^{T+1}||w_{t}||^{2}+ \lambda\sum_{i=1}^{n}\sum_{e_{t}\in R_{i}\cup\left\{\Theta\right\}}\sum_{e_{s} \in\prec(e_{t})}\frac{1}{norm_{t,s}}\xi_{ts}\\ & s.t.\langle w_{t}-w_{s},x_{i}\rangle\geq 1-\xi_{tis},1\leq j \leq T+1,\xi_{tis}\geq 0\end{split} \tag{8}\]

Since \(\xi_{its}\) does not need to be optimized since it can be easily determined by \(w_{t},w_{s}\). The final objective function can be reformulated as:

\[\min_{w_{t},\hat{L}}\sum_{t=1}^{T+1}||w_{t}||^{2}+\lambda\sum_{i=1}^{n}\hat{ L}(x_{i},R_{i},\prec,\mathbf{g}) \tag{9}\]

As can be seen, Eq.9 consists of two parts balanced by the trade-off parameter \(\lambda\). Specifically, the first part corresponds to the maximum margin of the learning system and it can also represent the complexity of the learning system, while the second part corresponds to the emotion loss function of the learning system implemented in hinge form.

### Parameter Estimation

Let \(\mathbf{w}=[w_{1};...;w_{T};w_{\Theta}]\), Eq. 9 is cast into a general form in SVM-type:

\[\begin{split}&\min_{\mathbf{w},\boldsymbol{\xi}}\frac{1}{2}|| \mathbf{w}||^{2}+\lambda C^{\top}\boldsymbol{\xi}\\ & s.t.~{}~{}A\mathbf{w}\geq\mathbf{1}_{p}-\boldsymbol{\xi}, \boldsymbol{\xi}\geq\mathbf{0}_{p}\end{split} \tag{10}\]

where \(p\) is the total number of label pairs, calculated by \(\sum_{i=1}^{n}\sum_{e_{t}\in R_{i}\cup\left\{\Theta\right\}}\sum_{e_{s}\in \prec(e_{t})}norm_{t,s}\) and \(\mathbf{1}_{p}(\mathbf{0}_{p})\) is the \(p\times 1\) all one (zero) vector. The entries in vector \(C\) correspond to the weights of hinge losses, i.e., the normalization term to balance the four kinds of label pairs. The matrix \(A\) corresponds to the constraints for instances which reflects the emotion relationships and the margin of the label pairs.

\(\boldsymbol{\xi}\) does not need to be optimized since it can be easily determined by \(\mathbf{w}\). Hence the objective function can be reformulated into the following form without \(\boldsymbol{\xi}\):

\[\min_{\mathbf{w}}F(\mathbf{w},G)=\frac{1}{2}||\mathbf{w}||^{2}+\lambda C^{ \top}(1_{p}-A\mathbf{w})_{+} \tag{11}\]

Figure 2: The overall framework of our proposed Relevant Emotion Ranking (RER) method.

 

Through minimizing the objective function \(F({\bf w},G)\), we can finally obtain parameter \({\bf w}\) and the ranking function \({\bf g}\). Eq. 11 involves a large scale optimization. To address Eq. 11, we consider an efficient Alternating Direction Method of Multipliers (ADMM) solution [2]. The basic idea of ADMM is to take the decomposition-coordinate procedure such that the solution of subproblems can be coordinated to find the solution to the original problem. We decompose \(G\) into \(M\) disjoint subsets, i.e., \(\{G_{1},G_{2},...,G_{M}\}\) and then Eq. 11 is converted in to the following form:

\[\min_{{\bf w^{0}},{\bf w^{1}},{\bf w^{m}}}\sum_{m=1}^{M}F({\bf w^{ m}},G^{m}), \tag{12}\] \[s.t.~{}~{}{\bf w^{m}}={\bf w^{0}},\forall m=1,...,M\]

The surrogate augmented Lagrangian Function (LF) was introduced into Eq. 12 and it was cast into the following form:

\[Lf(\{{\bf w^{0}},{\bf w^{1}},...,{\bf w^{m}}\},\{{\alpha^{m}}\}_{ m=1}^{M},\beta)=\sum_{m=1}^{M}F({\bf w^{m}},G^{m}) \tag{13}\] \[+\sum_{m=1}^{M}({\alpha^{m}})^{\top}({\bf w^{m}}-{\bf w^{0}})+ \frac{\beta}{2}\sum_{m=1}^{M}||{\bf w^{m}}-{\bf w^{0}}||^{2}\]

where \(\alpha,\beta\) are the Lagrange multiplies. The updating process of Eq. 13 is shown in Algorithm 1.

```
1:Decompose data set \(G\) into \(M\) disjoint subsets i.e., \(\{G_{1},G_{2},...,G_{M}\}\). Set iteration \(i=0\).
2:Initialize \(\{{\bf w^{0}_{0}},{\bf w^{1}_{0}},...,{\bf w^{M}_{0}},{\alpha^{1}_{0}},...,{ \alpha^{M}_{0}}\}\) as zeros.
3:while not converged do
4: Set \(i=i+1\)
5: Update \({\bf w^{0}_{i}},\{{\bf w^{m}_{i}},{\alpha^{m}_{i}}\}_{m=1}^{M}\) as: \(\{{\bf w^{m}_{i}}\}_{m=1}^{M}=\) argmin \(Lf({\bf w^{0}_{i-1}},\{{\bf w^{m}_{i-1}},{\alpha^{m}_{i-1}}\}_{m=1}^{M},\beta)\) \({\bf w^{1}}_{i}=\underset{{\bf w^{0}}}{\operatorname*{argmin}}\,Lf({\bf w^{0} },\{{\bf w^{m}_{i-1}},{\alpha^{m}_{i-1}}\}_{m=1}^{M},\beta\) \(\alpha^{m}_{i}=\alpha^{m}_{i-1}+\beta({\bf w^{m}_{i}}-{\bf w^{0}_{i}})^{\top}, \forall m=1,2,...,M\)
6:end while Output: Final \({\bf w^{0}}\)
```

**Algorithm 1** Parameter updating process.

## 4 Experiments

### Setup

We evaluate the proposed approach on two real-world corpora, one is document level and the other is sentence level:

**Sina Social News (News)** was collected from the Sina news _Society_ channel where readers can choose one of the six emotions such as _Amusement- t_, _Touching_, _Anger_, _Sadness_, _Curiosity_, and _Shock_ after reading a news article. As Sina is one of the largest online news sites in China, it is sensible to carry out experiments to explore the readers' emotion (social emotion). News articles with less than 20 votes were discarded since few votes can not be considered as proper representation of social emotion. In total, 5,586 news articles published from January 2014 to July 2016 were kept, together with the readers' emotion votes.

**Ren-CCPs corpus (Blogs)**[7] contains 34,719 sentences selected from blogs in Chinese. Each sentence is annotated with eight basic emotions from writer's perspective, including _anger_, _anxiety_, _expect_, _hate_, _joy_, _love_, _sorrow_ and _surprise_, together with their emotion scores indicating the level of emotion intensity which range from 0 to 1. Higher scores represents higher emotion intensity.

The statistics of the two corpora are shown in Table 1.

The two corpora were preprocessed by using word segmentation and filtering. The python jieba segmenter is used for the segmentation and a removal of stop words is performed based on a stop word desaurus. Words appeared only once or appeared in less tha

\begin{table}
\begin{tabular}{|p{28.5pt}|r||c|c|} \hline \multicolumn{2}{|c||}{**Sina Social News**} & \multicolumn{2}{c|}{**Ren-ECPs Corpus**} \\ \hline Category & \#Votes & Category & \#Scores \\ \hline Touching & 694,006 & Joy & 1,349.6 \\ Shock & 572,651 & Hate & 6,103.9 \\ Amusement & 869,464 & Love & 2,911.1 \\ Sadness & 837,431 & Sorrow & 2,042.5 \\ Curiosity & 212,559 & Surprise & 3,873.9 \\ Anger & 1,109,315 & Anger & 7,832.1 \\  & & Anxiety & 5,006.4 \\  & & Expect & 610.4 \\ \hline All & 4,295,426 & All & 29,729.9 \\ \hline \end{tabular}
\end{table}
Table 1: Statistics for the two corpora used in our experiments.

 

moved to alleviate data sparsity. We used the s-ingle layer long short-term memory (LSTM) networks Hochreiter and Schmidhuber (1997) to extract the features of each text. LSTM is one kind of recurrent neural networks, which can capture sequence information from text and can represent meanings of inputs in the reduced dimensional space. It treats text as a sequence of word embeddings and outputs a state vector over each word, which contains the information of the previous words. The final state vector can be used as the representation of the text. In our experiments, we set the dimension of each text representation to 100. During LSTM model training, we optimized the hyper parameters using a development dataset which is built using external data. We train LSTM using a learning rate of 0.001, a dropout rate of 0.3 and categorical cross-entropy as the loss function. The mini batch Cotter et al. (2011) size is set to 32. After that, the learned text representations are fed into the proposed system for relevant emotion ranking as has been previously presented in the Methodology section.

### Comparison with Baselines

There are only few baselines which address multiple emotions learning from text. We first compare the proposed framework with two baselines which have previously achieved the state-of-the-art performances on multi-emotion detection.

* **Emotion Distribution Learning (EDL)** Zhou et al. (2016): It learns a mapping function from texts to their emotion distribution's describing multiple emotions and their respective intensities based on label distribution learning. Moreover, the relationships of emotions are captured based on the Plutchik's wheel of emotions which are subsequently incorporated into the learning algorithm in order to improve the accuracy of emotion detection.
* **EmoDetect**Wang and Pal (2015): It outputs the emotion distribution based on a dimensionality reduction method using non-negative matrix factorization which combines several constraints such as emotions bindings, topic correlations and emotion lexicons in a constraint optimization framework.

For each method, 10-fold cross validation is conducted using the same feature construction method to get the final performance. Supposing \(n\) test instances and \(T\) emotion categories, several evaluation criteria as presented in Table 2 typically used in multi-label learning can be used to measure the efficiency of the proposed framework and the baseline approaches. PRO Loss concerning the prediction on all labels as well as the rankings of only relevant labels. Hamming loss evaluates how many times an emotion label is misclassified. Ranking loss evaluates the fraction of reversely ordered emotion pairs. One-error evaluates the fraction of sentences whose top-ranked emotion is not in the relevant emotion set. Average precision evaluates the average fraction of the relevant emotions ranked higher than a particular emotion. Coverage evaluates how many steps are needed to move down the ranked emotion list so as to cover all the relevant emotions of the example. Subset Accuracy evaluates the fraction of correctly classified examples, i.e. the predicted label set is identical to the ground-truth label set. \(F1_{exam}\) evaluates the averaged F1 Manning et al. (2008) over instances. MicroF1 pools each document decisions across categories, and then computes an effectiveness measure on the pooled contingency table. MacroF1 take the average of F1 for all categories. Note that the threshold \(\Theta\) is removed before evaluation. It should be pointed out that metrics from PRO Loss to \(F1_{exam}\) work by evaluating the learning systems performance on each test ex

\begin{table}
\begin{tabular}{l|p{42.7pt}} \hline
**Name** & **Definition** \\ \hline PRO Loss & \(\frac{1}{N^{\sum n}}\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{N}\sum\limits_{j=1} \frac{1}{n\text{max}_{k}}\) \\  & \(k_{t}\) is a modified 0-1 error/norm\({}_{t,b}\) the set size of label pair(\(i,x\)) \\ \hline Hamming Loss & \(\frac{1}{N^{\sum n}}||R_{t}||R_{t}||\) \\ \hline Rolling Loss & \(\frac{1}{N^{\sum n}}||S_{t}||R_{t}||\) \\  & where \(R_{t}\) is the indicator function. \\ \hline One Error & \(\frac{1}{N^{\sum n}}||R_{t}||^{2}\) \\ \hline Average Precision & \(\frac{1}{N^{\sum n}}||R_{t}||^{2}\) \\ \hline Average Precision & \(\frac{1}{N^{\sum n}}||R_{t}||^{2}\) \\ \hline \(\sum\limits_{j=1}^{N}||R_{t}||^{2}\) \\ \hline Average & \(\frac{1}{N^{\sum n}}||R_{t}||^{2}\) \\ \hline Subject Accuracy & \(\frac{1}{N^{\sum n}}||R_{t}||^{2}\) \\ \hline \(F1_{exam}\) & \(\frac{1}{N^{\sum n}}||R_{t}||(R_{t}+R_{t})||\) \\ \hline MicroF1 & \(F1_{c}||\sum\limits_{j=1}^{N}\sum\limits_{j=1}^{N}FP_{c}||\sum\limits_{j=1}^{ N}FN_{c}||\) \\ \hline MicroF1 & \(\frac{1}{N^{\sum n}}||F1(TP_{t},FR_{t},TN_{t},FN_{t})\) \\ \hline \end{tabular}
\end{table}
Table 2: Evaluation criteria for the Multi-Label Learning (MLL) methods. \(TP_{t},FP_{t},TN_{t},FN_{t}\) represent the number of true positive, false positive, true negative, and false negative test examples with respect to emotion \(t\) respectively. \(F1(TP_{t},FP_{t},TN_{t},FN_{t})\) represent specific binary classification metric F1 Manning et al. (2008).

 

ample separately, and then returning the mean value across the test set. MicroF1 and MacroF1 work by evaluating the learning systems performance on each emotion category separately, and then returning the macro/micro-averaged value across all e-motion categories.

The evaluation results using 10 different evaluation criteria are shown in Table 3. It can be observed that our proposed method Relevant Emotion Ranking(RER) outperforms baseline approaches on all 10 evaluation metrics on both datasets.

We have also extended RER by incorporating emotion relationships as constraints into the learning framework, denoted as RERC in Table 3. The correlation of every pair of emotions is calculated based on their respective votes from news articles or scores from blogs. It can be observed from Table 3 that in almost all cases, incorporating the constraints gives better performance. It should be pointed out that the results of the baseline approach EDL are slightly different from those reported in Zhou et al. (2016) since we employ L-STM for feature construction instead of recursive autoencoders.

Since relevant emotion ranking can be seen as an extension of multi-label learning, the proposed framework is also compared with 8 widely used multi-label learning methods using the threshold \(\Theta\) which is initialized as 0.15 after normalization, such as ML-KNN Zhang and Zhou (2007), LIFT Zhang (2011), CLR Furnkranz et al. (2008), Rank-SVM Zhang and Zhou (2014) , MLLOC Huang and Zhou (2012), BP-MLL Zhang and Zhou (2006), ECC Read et al. (2009) and MLP-RBF Zhang (2009). ML-KNN is based on the traditional \(k\)-nearest neighbor (KNN) algorithm. LIFT constructs features specific to each emotion by conducting clustering analysis on its positive or negative instances. CLR transforms MLL into a label ranking problem by pairwise comparison which considers each label pairs and rank all the labels without recognizing that only the rankings of relevant ones are crucial. Rank-SVM focuses on distinguishing relevant from irrelevant while neglecting the rankings of relevant ones. MLLOC tries to exploit emotion correlations in the expression data locally. The global discrimination fitting and local correlation sensitivity are incorporated into a unified framework. BP-MLL is derived from the back propagation algorithm through employing a novel error function capturing the characteristics of multi-label learning. ECC applies classifier chains in an ensemble framework. MLP-RBF gets the multi-label neural networks adopted from the traditional Radial Basis Function (RBF) neural networks.

For the MLL methods, the value of \(k\) is set to 8 in ML-KNN, ratio is 0.02 and \(\mu\) is 2 in ML-RBF. Linear kernel is used in LIFT. Rank-SVM uses the RBF kernel with the width \(\sigma\) equals to 1. The CR4.5 is used as the base classifier for CLR and ECC. The evaluatio

Figure 3: The top 10 words for each emotion label from Blogs dataset.

\begin{table}
\begin{tabular}{c|l|l|l|l} \hline \multirow{2}{*}{**Datasets**} & \multicolumn{3}{c|}{**Evaluation Criterion**} & \multicolumn{3}{c}{**Methods**} \\ \cline{2-5}  & **RER** & **RERC** & **EDL** & **EmoDetect** \\ \hline \multirow{5}{*}{Nees} & PRO loss(\(\downarrow\)) & 0.1992 & **0.1913** & 0.2596 & 0.2465 \\ \cline{2-5}  & Hamming Loss(\(\downarrow\)) & 0.2318 & **0.2277** & 0.2671 & 0.2696 \\ \cline{2-5}  & Ranking Loss(\(\downarrow\)) & 0.1477 & **0.1458** & 0.1689 & 0.1769 \\ \cline{2-5}  & One-error(\(\downarrow\)) & 0.1579 & **0.1562** & 0.2115 & 0.1903 \\ \cline{2-5}  & Average Precision(\(\uparrow\)) & 0.8775 & **0.8789** & 0.8028 & 0.7865 \\ \cline{2-5}  & Coverage(\(\downarrow\)) & 2.1938 & **2.1316** & 2.1959 & 2.2348 \\ \cline{2-5}  & Subset Accuracy(\(\downarrow\)) & 0.1899 & **0.1232** & 0.2026 & 0.2243 \\ \cline{2-5}  & \(F_{1/\text{center}}(\uparrow)\) & 0.7062 & **0.7143** & 0.6503 & 0.6469 \\ \cline{2-5}  & MicroF1(\(\uparrow\)) & 0.7086 & **0.7171** & 0.6346 & 0.6375 \\ \cline{2-5}  & MacroF1(\(\uparrow\)) & 0.6244 & **0.6291** & 0.5641 & 0.5767 \\ \hline \multirow{5}{*}{Blogs} & PRO loss(\(\downarrow\)) & 0.2354 & **0.2321** & 0.2739 & 0.2912 \\ \cline{2-5}  & Hamming Loss(\(\downarrow\)) & 0.2054 & **0.2014** & 0.2102 & 0.2202 \\ \cline{2-5}  & Ranking Loss(\(\downarrow\)) & 0.2137 & **0.2102** & 0.2589 & 0.2781 \\ \cline{2-5}  & One-error(\(\downarrow\)) & 0.4556 & **0.4580** & 0.5227 & 0.5352 \\ \cline{2-5}  & Average Precision(\(\uparrow\)) & 0.6749 & **0.6803** & 0.6411 & 0.5663 \\ \cline{2-5}  & Coverager(\(\downarrow\)) & 2.1269 & **2.1268** & 2.1699 & 2.8956 \\ \cline{2-5}  & Subset Accuracy(\(\downarrow\)) & **0.1663** & **0.1663** & 0.2116 & 0.2321 \\ \cline{2-5}  & \(F_{1/\text{center}}(\uparrow)\) & 0.5080 & **0.5114** & 0.4606 & 0.4650 \\ \cline{2-5}  & MicroF1(\(\uparrow\)) & 0.5093 & **0.5116** & 0.4620 & 0.4552 \\ \cline{2-5}  & MacroF1(\(\uparrow\)) & 0.4102 & **0.4161** & 0.3923 & 0.3622 \\ \hline \end{tabular}
\end{table}
Table 3: Comparison with emotion detection baselines. “\(\downarrow\)” indicates “the smaller the better”, while “+” indicates “the larger the better”. The best performance on each evaluation measure is highlighted by boldface.

 

approach in comparison to all MLL baselines are presented in Table 4. RERc performs the best on all evaluation measures. It verifies the advantage of RERc due to its consideration of varying intensities of the emotion labels and the ignorance of irrelevant ones during the learning of the relevant emotion ranking model. We also observe that, in most cases, the performance on the News dataset is better than that in the Blogs dataset. This may due to different types of text observed in these two platforms. News articles are more formal while bogs typically contain informal language and are more colloquial.

### Result Analysis

To fully understand the emotion detection results, we generate the top 10 most frequent words in the test set for each emotion label from Blogs dataset presented in Figure 3. Intuitively, we can find that most top words are quite expressive of their associated emotions. For example, the word "happy" delivers the emotion of _Joy_ and the word "tears" tells _Sorrow_, etc. Moreover, we also observe that there are some common words across multiple e-motion categories. For instance, "friend" appears in both _Joy_ and _Love_. The results demonstrate that the proposed framework can learn emotions from text precisely.

## 5 Conclusions

In this paper, we have proposed a novel framework to detect multiple emotions from text based on relevant emotion ranking. Moreover, the relationships between emotions are incorporated into the learning framework as constraints. Experimental results on both News and Blogs datasets show that the proposed framework is able to detect multiple emotions as well as generating rankings of relevant emotions. It performs remarkably better than the state-of-the-art baselines on multi-emotion detection and also outperforms several d-ifferent methods used for multi-label learning. In the future, we will explore the possibility of extending the current framework by detecting emotions at more fine-grained level, for example, e-motions associated with specific events reported in text.

#### Acknowledgments

The work was supported by the National Key R&D Program of China (No. 2017YFB1002801), the National Natural Science Foundation of China (61772132), the Natural Science Foundation of Jiangsu Province of China (BK20161430) and Innovate UK (103652).

\begin{table} width=1 

\end{table}
Table 4: Comparison with Multi-Label Learning (MLL) Methods.“\(\downarrow\)” indicates “the smaller the better”, while “\(\uparrow\)” indicates “the larger the better”. The best performance on each evaluation measure is highlighted by boldface.

 



## References

* Agrawal and An (2012) Ameeta Agrawal and Ajjun An. 2012. Unsupervised emotion detection from text using semantic and syntactic relations. In _Ieee/wic/acm International Conferences on Web Intelligence and Intelligent Agent Technology_. pages 346-353.
* Aman and Szpakowicz (2007) Saima Aman and Stan Szpakowicz. 2007. Identifying expressions of emotion in text. In _Text, Speech and Dialogue, International Conference, Tsd 2007, Pilsen, Czech Republic, September 3-7, 2007, Proceedings_. pages 196-205.
* Bao et al. (2009) Shenghua Bao, Shengliang Xu, Li Zhang, Rong Yan, Zhong Su, Dingyi Han, and Yong Yu. 2009. Joint emotion-topic modeling for social affective text mining. In _2009 Ninth IEEE International Conference on Data Mining_. IEEE, pages 699-704.
* Bao et al. (2012) Shenghua Bao, Shengliang Xu, Li Zhang, Rong Yan, Zhong Su, Dingyi Han, and Yong Yu. 2012. Mining social emotions from affective text. _IEEE transactions on knowledge and data engineering_ 24(9):1658-1670.
* Bertsekas and Tsitsiklis (1989) Dimitri P Bertsekas and John N Tsitsiklis. 1989. _Parallel and distributed computation: numerical methods. Reprint of the 1989 edition published by Prentice Hall.._ Prentice Hall.
* Bhowmick (2009) Plaban Kumar Bhowmick. 2009. Reader perspective emotion analysis in text through ensemble based multi-label classification framework. _Computer and Information Science_ 2(4):64.
* Blei et al. (2003) David M Blei, Andrew Y Ng, and Michael I Jordan. 2003. Latent dirichlet allocation. _Journal of machine Learning research_ 3(Jan):993-1022.
* Cotter et al. (2011) Andrew Cotter, Ohad Shamir, Nathan Srebro, and Karthik Sridharan. 2011. Better mini-batch algorithms via accelerated gradient methods. _Advances in Neural Information Processing Systems_ pages 1647-1655.
* Elisseeff and Weston (2001) Andre Elisseeff and Jason Weston. 2001. A kernel method for multi-labelled classification. In _International Conference on Neural Information Processing Systems: Natural and Synthetic_. pages 681-687.
* Furnkranz et al. (2008) Johannes Furnkranz, Eyke Hullermeier, Eneldo Loza Mencia, and Klaus Brinker. 2008. Multilabel classification via calibrated label ranking. _Machine learning_ 73(2):133-153.
* Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jurgen Schmidhuber. 1997. Long short-term memory. _Neural Computation_ 9(8):1735-1780.
* Huang and Zhou (2012) Sheng Jun Huang and Zhi Hua Zhou. 2012. Multi-label learning by exploiting label correlations locally. In _Twenty-Sixth AAAI Conference on Artificial Intelligence_. pages 949-955.
* Lei et al. (2014) Jingsheng Lei, Yanghui Rao, Qing Li, Xiaojun Quan, and Liu Wenyin. 2014. Towards building a social emotion detection system for online news. _Future Generation Computer Systems_ 37:438-448.
* Lin et al. (2008) Kevin Hsin-Yih Lin, Changhua Yang, and Hsin-Hsi Chen. 2008. Emotion classification of online news articles from the reader's perspective. In _Proceedings of the 2008 IEEE/WIC/ACM International Conference on Web Intelligence and Intelligent Agent Technology-Volume 01_. IEEE Computer Society, pages 220-226.
* Manning et al. (2008) Christopher D. Manning, Prabhakaraghavan, and Hinrich Schutze. 2008. An introduction to information retrieval. _Journal of the American Society for Information Science and Technology_ 43(3):824-825.
* Nicewander (1988) W. Alan Nicewander. 1988. Thirteen ways to look at the correlation coefficient. _American Statistician_ 42(1):59-66.
* Picard and Picard (1997) Rosalind W Picard and Roalind Picard. 1997. _Affective computing_, volume 252. MIT press Cambridge.
* Quan and Ren (2010) Changqun Quan and Fuji Ren. 2010. Sentence emotion analysis and recognition based on emotion words using ren-ceps. _International Journal of Advanced Intelligence Paradigms_ 2(1):105-117.
* Quan et al. (2015) Xiaojun Quan, Qifan Wang, Ying Zhang, Luo Si, and Liu Wenyin. 2015. Latent discriminative models for social emotion detection with emotional dependency. _ACM Transactions on Information Systems (TOIS)_ 34(1):2.
* Rao et al. (2012) Yanghui Rao, Xiaojun Quan, Liu Wenyin, Qing Li, and Mingliang Chen. 2012. Building word-emotion mapping dictionary for online news. In _SDAD 2012 The 1st International Workshop on Sentiment Discovery from Affective Data_. page 28.
* Read et al. (2009) Jesse Read, Bernhard Pfahringer, Geoff Holmes, and Eibe Frank. 2009. Classifier chains for multi-label classification. In _Joint European Conference On Machine Learning and Knowledge Discovery in Databases_. pages 254-269.
* Strapparava and Mihalcea (2008) Carlo Strapparava and Rada Mihalcea. 2008. Learning to identify emotions in text. In _Proceedings of the 2008 ACM symposium on Applied computing_. ACM, pages 1556-1560.
* Vapnik and Vapnik (1998) Vladimir Naumovich Vapnik and Vlamimir Vapnik. 1998. _Statistical learning theory_, volume 1. Wiley New York.
* Wang and Pal (2015) Yichen Wang and Aditya Pal. 2015. Detecting emotions in social media: A constrained optimization approach. In _Proceedings of the Twenty-Fourth International Joint Conference on Artificial Intelligence (IJCAI 2015)_. pages 996-1002.
* Xu et al. (2013) Miao Xu, Yu Feng Li, and Zhi Hua Zhou. 2013. Multi-label learning with pro loss. In _Twenty-Seventh AAAI Conference on Artificial Intelligence_

* Zhang (2009) Min Ling Zhang. 2009. M l-rbf : Rbf neural networks for multi-label learning. _Neural Processing Letters_ 29(2):61-74.
* Zhang (2011) Min Ling Zhang. 2011. Lift: multi-label learning with label-specific features. In _International Joint Conference on Artificial Intelligence_. pages 1609-1614.
* Zhang and Zhou (2006) Min Ling Zhang and Zhi Hua Zhou. 2006. Multi-abel neural networks with applications to functional genomics and text categorization. _IEEE Transactions on Knowledge Data Engineering_ 18(10):1338-1351.
* Zhang and Zhou (2007) Min Ling Zhang and Zhi Hua Zhou. 2007. MI-knn: A lazy learning approach to multi-label learning. _Pattern Recognition_ 40(7):2038-2048.
* Zhang and Zhou (2014) Min-Ling Zhang and Zhi-Hua Zhou. 2014. A review on multi-label learning algorithms. _IEEE transactions on knowledge and data engineering_ 26(8):1819-1837.
* Zhou et al. (2016) Deyu Zhou, Xuan Zhang, Yin Zhou, Quan Zhao, and Xin Geng. 2016. Emotion distribution learning from texts. In _Conference on Empirical Methods in Natural Language Processing_. pages 638-647.