Multi-Label Sentiment Analysis on 100 Languages with Dynamic Weighting for Label Imbalance
Organizations: Department of Electrical and Electronics Engineering, Bilkent University, 06800 Ankara, Turkey · Department of Computer Engineering, Bilkent University, 06800 Ankara, Turkey · National Magnetic Resonance Center UMRAM, 06800 Ankara, Turkey · DataBoss A.S., Bilkent Cyberpark, 06800 Ankara, Turkey
Abstract
We investigate cross-lingual sentiment analysis, which has attracted significant attention due to its applications in various areas including market research, politics and social sciences. In particular, we introduce a sentiment analysis framework in multi-label setting as it obeys Plutchik's wheel of emotions. We introduce a novel dynamic weighting method that balances the contribution from each class during training, unlike previous static weighting methods that assign non-changing weights based on their class frequency. Moreover, we adapt the focal loss that favors harder instances from single-label object recognition literature to our multi-label setting. Furthermore, we derive a method to choose optimal class-specific thresholds that maximize the macro-f1 score in linear time complexity. Through an extensive set of experiments, we show that our method obtains the state-of-the-art performance in 7 of 9 metrics in 3 different languages using a single model compared to the common baselines and the best-performing methods in the SemEval competition. We publicly share our code for our model, which can perform sentiment analysis in 100 languages, to facilitate further research.
Figures & tables
| Arabic | English | Spanish | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Method | Macro-F1 | Micro-F1 | Jaccard | Macro-F1 | Micro-F1 | Jaccard | Macro-F1 | Micro-F1 | Jaccard |
| Ours | 55.0 | 66.1 | 53.4 | 58.4 | 69.6 | 57.6 | 53.0 | 60.6 | 48.6 |
| Ours-SL | 51.3 | 57.5 | 44.3 | 56.4 | 68.7 | 56.5 | 50.5 | 56.6 | 45.3 |
| Tw-StAR [ 33 ] | 44.6 | 59.7 | 46.5 | 45.2 | 60.7 | 48.1 | 39.2 | 52.0 | 43.8 |
| FastText [ 40 ] | 35.3 | 40.2 | 25.5 | 35.0 | 39.9 | 25.5 | 27.0 | 31.9 | 20.6 |
| XLM-RoBERTa [ 23 ] | 48.2 | 65.2 | 53.0 | 56.1 | 69.3 | 57.3 | 48.3 | 57.0 | 47.3 |
| Validation Data | |||
|---|---|---|---|
| Training Data | Arabic | English | Spanish |
| Arabic (SP) | 52.7 | 39.6 | 30.7 |
| English (EN) | 37.9 | 60.1 | 36.2 |
| Spanish (SP) | 35.2 | 46.4 | 52.3 |
| AR + EN | 52.5 | 61.1 | 39.6 |
| AR + SP | 57.9 | 47.5 | 52.7 |
| Precision | Recall | F1 | Ranking Based | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Method | Macro | Micro | Macro | Micro | Macro | Micro | Zero-One | Coverage | RL | AP |
| Ours | 56.4 | 62.0 | 64.1 | 73.5 | 59.4 | 67.2 | 0.7787 | 3.51 | 0.0994 | 62.7 |
| Ours w/o FL | 54.2 | 62.4 | 60.6 | 69.7 | 57.1 | 65.9 | 0.7814 | 3.54 | 0.1021 | 61.1 |
| Ours w/o DW | 53.7 | 60.4 | 64.3 | 71.4 | 57.8 | 65.4 | 0.7814 | 3.52 | 0.0998 | 62.4 |
| Ours w/o FL+DW | 52.2 | 59.7 | 64.8 | 72.7 | 57.4 | 65.6 | 0.8020 | 3.56 | 0.1039 | 60.7 |
| Uni-LSTM | 54.1 | 60.6 | 61.7 | 71.0 | 57.1 | 65.4 | 0.7967 | 3.53 | 0.1009 | 60.4 |
| Method | Time Per Epoch | Total Time |
|---|---|---|
| Ours | 25.3 secs | 5 mins 4 secs |
| Ours w/o FL | 24.6 secs | 4 mins 59 secs |
| Ours w/o DW | 25.2 secs | 4 mins 58 secs |
| Ours w/o FL+DW | 25.0 secs | 5 mins 1 secs |
| Uni-LSTM | 17.6 secs | 3 mins 10 secs |
| Bi-RNN | 18.4 secs | 4 mins 7 secs |