Sentiment Analysis of Twitter Data Through Machine Learning Techniques

Part of the Computer Communications and Networks book series (CCN)


Cloud computing is a revolutionary technology for businesses, governments, and citizens. Some examples of Software-as-a-Services (SaaS) of cloud computing are banking apps, e-mail, blog, online news, and social networks. In this chapter, we analyze data sets generated by trending topics on Twitter that emerged from Mexican citizens that interacted during the earthquake of September 19, 2017, using sentiment analysis and supervised learning, based on the Ekman’s six emotional model. We built three classifiers to determine the emotions of tweets that belong to the same topic. The classifiers with the best accuracy for predicting emotions were Naive Bayes and support vector machine. We found that the most frequent predicted emotions were happiness, anger, and sadness; also, that 6.5% of predicted tweets were irrelevant. We provide some recommendations about the use of machine learning techniques in sentiment analysis. Our contribution is the expansion of the emotions range, from three (negative, neutral, positive) to six in order to provide more elements to understand how users interact with social media platforms. Future research will include validation of the method with different data sets and emotions, and the addition of new artificial intelligence techniques to improve accuracy.


Cloud computing Sentiment analysis Machine learning ML Twitter Naive Bayes Ekman’s model 


  1. 1.
    Almarabeh T, Majdalawi YK, Mohammad H (2016) Cloud computing of e-governmentGoogle Scholar
  2. 2.
    Sasikala P (2012) Cloud computing and E-governance: advances, opportunities and challenges. Intl J Cloud Appl Comput (IJCAC) 2(4):32–52Google Scholar
  3. 3.
    Jadhav B, Patankar A (2018) Opportunities and challenges in integrating cloud computing and big data analytics to e-governance. Int J Comput Appl 180(15):6–11Google Scholar
  4. 4.
    Lohr S (2012) The age of big data. New York Times, 11 (2012)Google Scholar
  5. 5.
    Liebowitz J (2001) Knowledge management and its link to artificial intelligence. Expert Syst Appl 20(1):1–6CrossRefGoogle Scholar
  6. 6.
    Fan W, Bifet A (2013) Mining big data: current status, and forecast to the future. ACM SIGKDD Explor Newsl 14(2):1–5CrossRefGoogle Scholar
  7. 7.
    Wu X, Zhu X, Wu GQ, Ding W (2014) Data mining with big data. IEEE Trans Knowl Data Eng 26(1):97–107CrossRefGoogle Scholar
  8. 8.
    Sandoval-Almazán R, Valle-Cruz D (2016) Understanding network links in Twitter: a Mexican case study. In: Proceedings of the 17th international digital government research conference on digital government research. ACM, pp 122–128Google Scholar
  9. 9.
    Shaikh S, Feldman LB, Barach E, Marzouki Y (2017) Tweet sentiment analysis with pronoun choice reveals online community dynamics in response to crisis events. In: Advances in cross-cultural decision making. Springer, Cham, pp 345–356Google Scholar
  10. 10.
    Vo BKH, Collier NIGEL (2013) Twitter emotion analysis in earthquake situations. Intl J Comput Linguist Appl 4(1):159–173Google Scholar
  11. 11.
    Sandoval-Almazan R (2019) Using twitter in political campaigns: The case of the PRI candidate in Mexico. In: Civic engagement and politics: concepts, methodologies, tools, and applications. IGI Global, pp 710–726Google Scholar
  12. 12.
    Sandoval-Almazán R, Valle-Cruz D (2018) Towards an understanding of Twitter networks: the case of the state of Mexico. First Monday, vol 23, no 4Google Scholar
  13. 13.
    Sandoval-Almazan R, Valle-Cruz D (2018) Facebook impact and sentiment analysis on political campaigns. In: Proceedings of the 19th annual international conference on digital government research: governance in the data age. ACM, p 56Google Scholar
  14. 14.
    Chen M, Zhang Y, Li Y, Mao S, Leung VC (2015) EMC: emotion-aware mobile cloud computing in 5G. IEEE Netw 29(2):32–38CrossRefGoogle Scholar
  15. 15.
    Preethi G, Krishna PV, Obaidat MS, Saritha V, Yenduri S (2017) Application of deep learning to sentiment analysis for recommender system on cloud. In 2017 international conference on computer, information and telecommunication systems (CITS). IEEE, pp 93–97Google Scholar
  16. 16.
    Krishna PV, Misra S, Joshi D, Obaidat MS (2013) Learning automata based sentiment analysis for recommender system on cloud. In: 2013 international conference on computer, information and telecommunication systems (CITS). IEEE, pp 1–5Google Scholar
  17. 17.
    Assunção MD, Calheiros RN, Bianchi S, Netto MA, Buyya R (2015) Big data computing and clouds: trends and future directions. J Parallel Distrib Comput 79:3–15CrossRefGoogle Scholar
  18. 18.
    Karyotis C, Doctor F, Iqbal R, James A, Chang V (2018) A fuzzy computational model of emotion for cloud based sentiment analysis. Inf Sci 433:448–463CrossRefGoogle Scholar
  19. 19.
    Ali F, Kwak D, Khan P, Islam SR, Kim KH, Kwak KS (2017) Fuzzy ontology-based sentiment analysis of transportation and city feature reviews for safe traveling. Transp Res Part C: Emerg Technol 77:33–48CrossRefGoogle Scholar
  20. 20.
    Sreeja PS, Mahalakshmi GS (2017) Emotion models: a review. Int J Control Theory Appl 10:651–657Google Scholar
  21. 21.
    Ekman PE, Davidson RJ (1994) The nature of emotion: fundamental questions. Oxford University Press, OxfordGoogle Scholar
  22. 22.
    Plutchik R (1965) What is an emotion? J Psychol 61(2):295–303CrossRefGoogle Scholar
  23. 23.
    Munezero MD, Montero CS, Sutinen E, Pajunen J (2014) Are they different? affect, feeling, emotion, sentiment, and opinion detection in text. IEEE Trans Affect Comput 5(2):101–111CrossRefGoogle Scholar
  24. 24.
    Nakamura (1993) Kanjo hyogen jiten [dictionary of emotive expressions]. Tokyodo, Teluk IntanGoogle Scholar
  25. 25.
    Yang Y, Jia J, Zhang S, Wu B, Chen Q, Li J et al (2014) How do your friends on social media disclose your emotions? In: Twenty-eighth AAAI conference on artificial intelligenceGoogle Scholar
  26. 26.
    Wang Y, Pal A (2015) Detecting emotions in social media: a constrained optimization approach. In: Twenty-fourth international joint conference on artificial intelligenceGoogle Scholar
  27. 27.
    Cambria E, Livingstone A, Hussain A (2012) The hourglass of emotions. In Cognitive behavioural systems. Springer, Berlin, pp 144–157CrossRefGoogle Scholar
  28. 28.
    Zhang L, Hua K, Wang H, Qian G, Zhang L (2014) Sentiment analysis on reviews of mobile users. Procedia Comput Sci 34:458–465CrossRefGoogle Scholar
  29. 29.
    Zhang L, Hua K, Wang H, Qian G, Zhang L (2014) Sentiment analysis on reviews of mobile users. Procedia Comput Sci 34:458–465CrossRefGoogle Scholar
  30. 30.
    Prabowo R, Thelwall M (2009) Sentiment analysis: a combined approach. J Informetr 3(2):143–157CrossRefGoogle Scholar
  31. 31.
    Kumar M, Bala A (2016) Analyzing Twitter sentiments through big data. In: 2016 3rd international conference on computing for sustainable global development (INDIACom). IEEE, pp 2628–2631Google Scholar
  32. 32.
    Subramaniyaswamy V, Vijayakumar V, Logesh R, Indragandhi V (2015) Unstructured data analysis on big data using map reduce. Procedia Comput Sci 50:456–465CrossRefGoogle Scholar
  33. 33.
    Al-Kabi M, Al-Ayyoub M, Alsmadi I, Wahsheh H (2016) A prototype for a standard arabic sentiment analysis corpus. Int Arab J Inf Technol 13(1A):163–170Google Scholar
  34. 34.
    Kune R, Konugurthi PK, Agarwal A, Chillarige RR, Buyya R (2016) The anatomy of big data computing. Softw Pract Exp 46(1):79–105Google Scholar
  35. 35.
    Sidorov G et al (2013) Empirical study of machine learning based approach for opinion mining in tweets. In: Batyrshin I, González Mendoza M (eds) Advances in artificial intelligence. MICAI 2012. Lecture notes in computer science. Springer, Berlin, vol 7629Google Scholar
  36. 36.
    Chawla NV, Bowyer KW, Hall LO, Kegelmeyer WP (2002) SMOTE: synthetic minority over-sampling technique. J Artif Int Res AI Access Found 16:321–357CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.Autonomous University of the State of MexicoValle Hermoso, ZumpangoMexico
  2. 2.Autonomous University of the State of MexicoTolucaMexico

Personalised recommendations