{'fraction_non_alphanumeric': 0.03759431098777209, 'fraction_numerical': 0.011143873037897841, 'mean_word_length': 4.663801571709234, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multi-task Learning for Target-dependent Sentiment Classification

Detecting and aggregating sentiments toward people, organizations, and events expressed in unstructured social media have become critical text mining operations. Early systems detected sentiments over whole passages, whereas more recently, target-specific sentiments have been of greater interest. In this paper, we present MTTDSC, a multi-task target-dependent sentiment classification system that is informed by feature representation learnt for the related auxiliary task of passage-level sentiment classification. The auxiliary task uses a gated recurrent unit (GRU) and pools GRU states, followed by an auxiliary fully-connected layer that outputs passage-level predictions. In the main task, these GRUs contribute auxiliary per-token representations over and above word embeddings. The main task has its own, separate GRUs. The auxiliary and main GRUs send their states to a different fully connected layer, trained for the main task. Extensive experiments using two auxiliary datasets and three benchmark datasets (of which one is new, introduced by us) for the main task demonstrate that MTTDSC outperforms state-of-the-art baselines. Using word-level sensitivity analysis, we present anecdotal evidence that prior systems can make incorrect target-specific predictions because they miss sentiments expressed by words independent of target.


Introduction
As the volume of news, blogs [8], and social media [14] far outstrips what an individual can consume, sentiment classification (SC) [15,12] has become a powerful tool for understanding emotions toward politicians, celebrities, products, governance decisions, etc. Of particular interest is to identify sentiments expressed toward specific entities, i.e., target dependent sentiment classification (TDSC). Recent years have witnessed many TDSC approaches [23,21,22] with increasing sophistication and accuracy.
Possibly because research on passage-level and target-dependent sentiment classification were separated in time by the dramatic emergence of deep learning, TDSC systems predominantly use recurrent neural networks (RNNs) and borrow little from passage-level tasks and trained models. From the perspective of curriculum learning [2], this seems suboptimal: representation borrowed from passage-level SC should inform TDSC well. Moreover, whole-passage labeling entails considerably lighter cognitive burden than target-specific labeling. As a result, whole-passage gold labels can be collected at larger volumes.
In this paper, we present MTTDSC, Multi-Task Target Dependent Sentiment Classifier 1 , a novel multi-task learning (MTL) system that uses passage-level SC as an auxiliary task and TDSC as the main task. MTL has shown significant improvements in many fields of Natural Language Processing and Computer Vision. In basic ('naive') MTL, we jointly train multiple models for multiple tasks with some shared parameters, usually in network layers closest to the inputs [13], resulting in shared input representation learning. Symmetric, uncontrolled sharing can be detrimental to some tasks.
In MTTDSC, the auxiliary SC task uses bidirectional GRUs, whose states are pooled over positions to make whole-passage predictions. This sensitizes the auxiliary GRU to target-independent expressions of sentiments in words. The main TDSC task combines the auxiliary GRUs with its own target-specific GRUs. The two tasks are jointly trained. If passages with both global and target-specific labels are available, they can be shared between the tasks. Otherwise, the two tasks can also be trained on disjoint passages. MTTDSC can be interpreted as a form of task-level curriculum learning [2], where the simpler whole-passage SC task learns to identify sentiments latent in word vectors, which then assists the more challenging TDSC task. Static sentiment lexicons, such as SentiWordNet [6], are often inadequate for dealing with informal media.
Using two standard datasets, as well as one new dataset we introduce for the main task, we establish superiority of MTTDSC over several state-of-theart approaches. While improved accuracy from additional training data may seem unsurprising from a learning perspective, we show that beneficial integration of the auxiliary task and data is nontrivial. Simpler multi-task approaches [13], where a common feature extraction network is used for jointly training on multiple tasks, perform poorly. We also use word-level sensitivity tests to obtain anecdotal evidence that direct TDSC approaches (that do not borrow from whole-passage SC models) make target-specific prediction errors because they misclassify the (target independent) sentiments expressed by words. Thus, MTTDSC also provides a more interpretable model, apart from accuracy gains.
The contributions of our work are summarized as follows: -MTTDSC, a novel neural MTL architecture designed specifically for TDSC. We show the superiority of our model and also compare it with other state-of-the-art models of TDSC and multi-task learning. -A new dataset for target dependent sentiment classification which is better for real world analysis on social media data. -Thorough investigation of the reasons behind the success of MTTDSC.
In particular, we show that current models fail to capture many emotive words owing to insufficient training data.

Related work
Target dependent sentiment classification: An input text passage is a sequence of words w 1 , w 2 , . . . , w N . We use 'tweet' and 'passage' interchangeably, given the preponderance of social media in TDSC applications. One word position or contiguous span is identified as a target. For simplicity, we will assume compounds like New York to be pre-fused and consider a target as a single word position. A passage may have one or more targets. In gold labeled instances, the target is associated with one of three labels {−1, 0, +1}, corresponding to negative, neutral, and positive sentiments respectively. The passage-level task has a label associated with the whole passage [11], rather than a specific target position. E.g., in the tweet "I love listening to electronic music, however artists like :::: Avici & ::::: Tiesta copy it from others", the overall sentiment is positive but the sentiments associated with both targets 'Avici' and 'Tiesta' are negative.
TDLSTM [20] and TDParse [22] divide the sentence into left context, right context and the target entity, and then combine their features. TDLSTM uses a left-to-right LSTM lr on the context left of the target (w 1 , . . . , w i ), a rightto-left LSTM rl on the context right of the target (w i , . . . , w N ), and a fully connected layer W tdlstm that combines signals from LSTM lr and LSTM rl . If LSTM state vectors are in R D , then 2 W tdlstm ∈ R 2D×3 . Given a tweet and target position i, LSTM lr is applied to (pre-trained and pinned) input word embeddings of w 1 , . . . , w i , obtaining state vectors LSTM lr where ∆ 3 is a 3-class multinomial distribution over {−1, 0, 1}, obtained from the softmax. Standard cross-entropy against the one-hot gold label is used for training. TCLSTM [20] is a slight modification to TDLSTM, where the authors also concatenated the embedding of the target entity with each token in the given sentence. They showed that TCLSTM has a slight improvement over TDLSTM. By pooling embeddings of words appearing on dependency paths leading to the target position, TDParse [22] improves further on TDLSTM accuracy. More details of these systems are described in Section 4.4, along with their performance. The major problem in TDParse is the inability to learn compositions of words. TDParse usually fails for the sentences containing a polar word which is not related to the entity.
The "naive segmentation" (Naive-Seg) model of Wang et al. [22] concatenates word embeddings of left context, right context and sub sentences of the tweets. Various pooling functions are used to combine them and an SVM is used for labeling. Naive-Seg+ extends Naive-Seg by using sentiment lexicon based features. TDParse extends Naive-Seg by using dependency parse paths incident on the target entity to collect words whose embeddings are then pooled. TDParse+ further extends TDParse by using sentiment lexicon [6] based features. TDParse+ beats TDLSTM largely because of carefully engineered features (including SentiWord-Net based features), but may not generalize to diverse datasets.
Pooling word embeddings over dependency paths may not capture complex compositional semantics. Given enough training data, TDLSTM should capture complex compositional semantics. But in practice, neural sequence models start with word vectors that were not customized for sentiment detection, and then get limited training data.
Multi-task learning: Multi-task learning has been used in many applications related to NLP. Peng et al. [16] showed improved results in semantic dependency parsing be learning three semantic dependency graph formalisms. Choi et al. [3] improved the performance on question answering by jointly training answer generation and answer retrieval model. Sluice networks proposed by Ruder et al. [18] claims to be a generalized model which could learn to control the sharing of information between different task models. Sluice networks do not perform well for TDSC, as the sharing of information happens at all positions of the sentence. On the other hand, our model forces the auxiliary task to learn feature representation at all positions and share them at the appropriate locations with the main task.

MTTDSC: A multi-task approach to TDSC
Recurrent models for TDSC have to solve two challenging problems in one shot: identify sentiment-bearing words in the passage, and use influences between hidden states to connect those sentiments to the target. A typical TDSC system attempts to do this as a self-contained learner, without representation support from an auxiliary learner solving the simpler task of whole-passage SC. We present anecdotes in Section 4.5 that reveal the limitations of such approaches. In response, we propose a multi-task learning (MTL) approach called MTTDSC. Representations trained for the auxiliary task (Section 3.1) inform the main task (Section 3.2). The combined loss objective is described in Section 3.3 and implementation details are presented in Section 3.4.
Our MTL framework is significantly different from traditional ones. In particular, we do not require auxiliary and main task gold labels to be available on the same instances. (This makes it easier to collect larger volumes of auxiliary labeled data.) As a result, in standard MTL, attempts to improve auxiliary task performance interferes with the learning of feature representations that are important for the main task. To solve this problem, we use separate RNNs for the two tasks, the output of the auxiliary RNN acting as additional features to the main model. This ensures that the gradients from the auxiliary task loss do not unduly interfere with the weights of the main task RNN.

Auxiliary task
The network for the auxiliary task is shown at the top of Figure 1. The auxiliary model consists of a left-to-right GRU aux lr , a right-to-left GRU aux rl , and a fully- Average pooling lets the auxiliary model learn useful features at all positions of the tweet. This helps the primary task, as the target entity of the primary task can be at any position. The whole-tweet prediction output is SoftMax(x x x W aux ) ∈ ∆ 3 . Again, cross-entropy loss is used.

Main task
Beyond the auxiliary model components, the main task uses a left-to-right GRU main lr , a right-to-left GRU main rl , and a fully connected layer W main ∈ R 4D×3 as model components.
Let target entity be at token position i. (3) Our network for the situation where the auxiliary and main tasks do not share instances is shown in Figure 1.

Training the tasks
Suppose the auxiliary task has instances {(x i , y i ) : i = 1, . . . , A} and the main task has instances {(x j , y j ) : j = 1, . . . , M }. Let GRU * * be all the GRU model parameters in {GRU aux lr , GRU aux rl , GRU main lr , GRU main rl }. Then our overall loss objective is loss main (x j , y j ; GRU * * , W main ) (4) Standard cross-entropy is used for both loss aux and loss main . Before training the full objective above, we pre-train only the auxiliary task for one epoch. The situation where instances may be shared between the auxiliary and main tasks is similar, except that GRU cells are now directly shared between auxiliary and main tasks. We anticipate this multi-task setup to do better than, say, fine-tuning word embeddings in TDLSTM, because the auxiliary task is better related to the main task than unsupervised word embeddings. By the same token, we do not necessarily expect our auxiliary learner to outperform more direct approaches for the auxiliary task -its goal is to supply better word/span representations to the main task.

Implementation details
GRU instead of LSTM: We used GRUs instead of LSTMs, which are more common in prior work. GRUs have fewer parameters and are less prone to overfitting. In fact, our TDGRU replacement performs better than TDLSTM (Tables  1 and 2). Hyperparameters: We set the hidden unit size of each GRU network as 64. Recurrent dropout probability of the GRU is taken as 0.2. We also used a dropout of 0.2 before the last fully connected layer. For training the models we used the Adam optimizer with learning rate of 0.001, β 1 = 0.9, β 2 = 0.999. We used a mini-batch size of 64. Ensemble: While reimplementing and/or running baseline system codes, we saw large variance in test accuracy scores for random initializations of the network weights. We improved the robustness of our networks by using an ensemble of the same model trained on the complete dataset with different weight initializations. The output class scores of the final model are the average of the probabilities returned by members of the ensemble. For a fair comparison, we also use the same ensembling for all our baselines. Word embeddings: MTTDSC, TDLSTM and TCLSTM use GloVe embeddings [17] trained on the Twitter corpus.

Experiments
We summarize datasets, competing approaches, and accuracy measures, followed by a detailed performance comparison and analysis. Go [7]: This is a whole-passage SC dataset, containing 1.6M tweets automatically annotated using emoticons, highlighting that SC labeling can be easier to acquire at large scale. It has only positive and negative classes. Sanders [19]: The second dataset is provided by Sanders Analytics and has 5,513 tweets over all 3 classes. These are manually annotated.

Datasets for main TDSC task
Dong [5]: Target entities are marked in tweets (one target entity per tweet), and one of three sentiment labels manually associated with each target. The training and test folds contain 6,248 and 692 instances respectively. The class distribution is 25%, 50% and 25% for negative, neutral and positive respectively. Election1 [22]: Derived from tweets about the recent UK election, this dataset contains 3,210 training tweets that mention 9,912 target entities and 867 testing tweets that mention 2,675 target entities. The class distribution is 45.3%, 36.5%, and 17.7% for negative, neutral and positive respectively, which is highly unbalanced. There are an average of 3.16 target entities per tweet. Election2: In this paper, we introduce a new TDSC dataset, also based on UK election tweets. We first curated a list of candidate hashtags related to the UK General Elections, such as #GE2017, #GeneralElection and #VoteLabour. The collection was done during a period of 12 days, from June 2, 2017 through June 14, 2017. After removing retweets and duplicates (tweets with the same text), we ended up with 563,812 tweets. After running the named entity tagger, we observed that 158,978 tweets (28.19%) had at least one named entity, 38,809 tweets (6.88%) had at least two named entities and the remaining 7,992 tweets (1.42%) had three or more named entities. We took all the tweets which had at least two named entities, and randomly sampled an equal number of tweets from the set of tweets which had only one named entity.
Mean absolute error (MAE) It is defined as (1/I) i |y i −ŷ i |. Downstream applications that use the numerical values ofŷ will want MAE to be small.
Pair inversion rate (PIR): For a pair of instances (i, j), if y i > y j butŷ i < y j , that is an inversion. PIR is then defined as i =j (y i − y j )(ŷ i −ŷ j ) < 0 I 2 . Closely related to the area under the curve (AUC) for 2-class problems, PIR is widely used in Information Retrieval [10].  Table 1 shows aggregated and per-class accuracy for the competing methods. It has three groups of rows. The first group includes methods that use no or minimal target-specific processing. The second group includes the best-known recent target-dependent methods. The third group includes our methods and their variants, to help elucidate and justify the merits of our design. Target independent baselines: In the first block, LSTM means a wholetweet LSTM was applied, followed by a linear SVM on the final state. Targetind [9] pools embedding features from the entire tweet. Target-dep+ extends Target-dep. Target-dep+ extends Target-dep by identifying sentiment-revealing context features with the help of multiple lexicons (such as SentiWordNet 3 ).

Various methods and their performance
Prior target-dependent baselines: The second block shows more competitive target-aware TDSC approaches. TDLSTM and TCLSTM are from Tang et al. [20]. Naive-Seg+ segments the tweet using punctuations. Word vectors in each segment are pooled to give a segment embedding. Additional features are generated from the left and right contexts based on multiple sentiment lexicons. TDParse [22] uses a syntactic parse to pool embeddings of words connected to the target. TDParse+ extends TDParse by adding features from sentiment lexicons. TDParse+(m) considers the presence of the same target multiple times in the tweet. Feature vectors generated from multiple target positions are merged using pooling functions. MTTDSC and variations: The third block shows MTTDSC and some variations. TDGRU replaces the two LSTMs of TDLSTM with two GRUs [4] which have fewer parameters but perform slightly better than LSTMs. In TD-GRU+SVM, we first train the TDGRU model. Then, at entity position i, we TDGRU with SVM is expected to perform better due to the non-linear nature of the features at the penultimate layer, which the SVM can then recognize without overfitting problems. TD naive MTL is similar to MTTDSC, but, rather than having separate GRUs for primary and auxiliary tasks, shared GRU lr and GRU rl are used for both tasks. The tasks are trained jointly as in MTTDSC. In TDFT, we first train GRU lr , GRU rl and W aux on the auxiliary whole-passage SC task. We then use the weights of GRU lr and GRU rl learnt by the auxiliary task in TDGRU and train it on TDSC with a new W main .
Observations: Table 1 shows that MTTDSC outperforms all the baselines across all the measures on Dong dataset. MTTDSC achieves 2.8%, 3.41%, 7.14% and 24.5% relative improvements in accuracy, F 1 , MAE and PIR respectively over TDParse+(m) (best model by Wang et al. [22]). The improvement in 2-class F 1 is also substantial (5.1%). MTTDSC maintains a better balance between precision, recall and F 1 across the three classes (Table 1(b)).
TDFT improves on TDLSTM and TDGRU because it learns important features during pre-training. TDFT is better than TD naive MTL; jointly training the latter results in auxiliary loss prevailing over primary loss. TD naive MTL also loses to MTTDSC, because, in fine tuning, the primary task training makes the model forget some auxiliary features critical for the primary task. Summarizing, MTTDSC's gains are not explained by the large volume of auxiliary data alone; good network design is critical. Table 2 shows results for Election2. The trend is preserved, with our gains in macro-F 1 being more noticeable than micro-accuracy. This is expected given the Table 3: Performance comparison on Election1 dataset. The results of the baselines are taken from Table 3 of Wang et al. [22] where TDPWindow-12 (which extracts features exactly like TDParse+, but limits the size of left and right contexts to 12 tokens) was reported as the best model. To save space, we report the accuracy w.r.t. only three measures. The broad trends are similar to Election2.

Side-by-side diagnostics and anecdotes
Given their related architectures, we picked TDLSTM and MTTDSC, and focused on instances where MTTDSC performed better than TDLSTM, to tease out the reasons for the improvement.
Word-level sensitivity analysis: For each word in the context of the target entity, we replaced the word with UNK (unknown word) and noted the drops in scores of labels +1 and −1. A large drop in the score of label +1 means the word was regarded as strongly positive, and a large drop in the score of label −1 means the word was regarded as strongly negative. We use these scores to color-code context words in the form of a heatmap. Figure 4 shows the positive and the negative words highlighted accordingly to their sensitivity scores. The words highlighted in green color contribute to the positive label and the words highlighted red contribute to the negative label. In the first row, MTTDSC correctly identifies funny as a positive word, whereas TDLSTM considers funny to be a negative word. TDLSTM also finds stronger negative polarity in neutral words like the and covering. In the second row, MTTDSC correctly identifies hilarious as a positive word, whereas TDLSTM finds hilarious strongly negative.
In the third row, MTTDSC finds hilarious positive, whereas TDLSTM misses the signal. Although TDLSTM correctly identifies more positive words in the fourth row than MTTDSC, it also incorrectly identifies negative words like randomly and people, leading to an overall incorrect neutral prediction. The examples show that TDLSTM either misses or misclassifies crucial emotive, polarized context words.

Conclusion
We presented MTTDSC, a multi-task system for target-dependent sentiment classification. By exploiting the easier auxiliary task of whole-passage senti-

+1
merry christmas ! i keep seeing that a christmas carol commercial. now i feel like britney spears , randomly wishing people a merry christmas .

+1
ment classification, MTTDSC improves on recent TDSC baselines. The auxiliary LSTM learns to identify corpus-specific, position-independent sentiment in words and phrases, whereas the main LSTM learns how to associate these sentiments with designated targets. We tested our model on three benchmark datasets, of which we introduce one here, and obtained clear gains in accuracy compared to many state-of-the-art models.

Acknowledgement
The project was partially supported by IBM, Early Career Research Award (SERB, India), and the Center for AI, IIIT Delhi, India.