Sentiment Analysis of Tweets Using Supervised Learning Algorithms

  • Raj P. MehtaEmail author
  • Meet A. Sanghvi
  • Darshin K. Shah
  • Artika Singh
Conference paper
Part of the Advances in Intelligent Systems and Computing book series (AISC, volume 1045)


The proliferation of user-generated content (UGC) on social media platforms has made user opinion tracking a strenuous job. Twitter, being a huge microblogging social network, could be used to accumulate views about politics, trends, and products, etc. Sentiment analysis is a mining technique employed to peruse opinions, emotions, and attitude of people toward any subject. This is conceptualized using digital data (text, video, audio, etc.) or psychological characteristics of humans. This procedure assists in opinion mining without having to read a plethora of tweets manually. The results could be wielded to provide an edge for businesses and governments in rolling out new entities (policies, products, topic, event). Cleaning data is an important step here, which we accomplished using regular expressions and NLTK library in Python. We implemented nine separate algorithms to classify tweets and compare their performance on cleaned data. It was observed that the convolutional neural network produces the most optimal results at 79% accuracy.


Human emotions Machine learning Opinion mining Sentiment analysis (SA) Supervised learning Long short-term memory (LSTM) Twitter Naive Bayes (NB) Tweets Natural language processing Multilayer perceptron (MLP) Convolutional neural network (CNN) Random forest XGBoost Max entropy Decision tree Support vector machine (SVM) 


  1. 1.
    Pang, B., Lee, L.: Opinion mining and sentiment analysis. Found. Trends Inf. Retr. 2(1–2), 1–135 (2008)CrossRefGoogle Scholar
  2. 2.
    Jain, A.P., Dandannavar, P.: Application of machine learning techniques to sentiment analysis. In: 2nd International Conference on Applied and Theoretical Computing and Communication Technology (iCATccT) (2016), pp. 628–632Google Scholar
  3. 3.
    Cambria, E., Poria, S., Gelbukh, A., Thelwall, M.: Sentiment analysis is a big suitcase. IEEE Comput. Soc., pp. 74–80 (November/December 2017)Google Scholar
  4. 4.
    Wang, Y., Rao, Y., Wu, L.: A review of sentiment semantic analysis technology and progress. In: 2017 13th International Conference on Computational Intelligence and Security, pp. 452–455Google Scholar
  5. 5.
    Youness, M., Mohammed, E., Jamma, B.: A parallel semantic sentiment analysis (2017)Google Scholar
  6. 6.
    Deshwal, A., Sharma, S.K.: Twitter sentiment analysis using various classification algorithms. In: 2016 5th International Conference on Reliability, Infocom Technologies and Optimization (ICRITO) (Trends and Future Directions), Sep. 7–9, 2016, AIIT, pp. 251–257. Amity University Uttar Pradesh, Noida, IndiaGoogle Scholar
  7. 7.
    Raghuvanshi, N., Patil, J.M.: A brief review on sentiment analysis. In: International Conference on Electrical, Electronics, and Optimization Techniques (ICEEOT) (2016), pp. 2827–2831Google Scholar
  8. 8.
    Chachra, A., Mehndiratta, P., Gupta, M.: Sentiment analysis of text using deep convolution neural networks. In: Proceedings of 2017 Tenth International Conference on Contemporary Computing (IC3), 10–12 August 2017. Noida, India (2017)Google Scholar
  9. 9.
    Kumar, M., Bala, A.: Analyzing twitter sentiments through big data. In: 2016 International Conference on Computing for Sustainable Global Development (INDIACom)Google Scholar
  10. 10.
    Ramadhani, A.M., Goo, H.S.: Twitter sentiment analysis using deep learning methods. In: 2017 7th International Annual Engineering Seminar (InAES), Yogyakarta, IndonesiaGoogle Scholar
  11. 11.
    Baj-Rogowska, A.: Sentiment analysis of facebook posts: the uber case. In: The 8th IEEE International Conference on Intelligent Computing and Information Systems (ICICIS 2017)Google Scholar
  12. 12.
    Kaggle Page For Twitter Sentiment Analysis Dataset Datahttps:, 22 Dec 2018
  13. 13.
    Wikipedia Page for Naive Bayes Classifier [Online], Available:, 22 Dec 2018
  14. 14.
    Wang, L. ed.: Support Vector Machines: Theory and Applications (Vol. 177). Springer Science & Business Media, Berlin (2005)Google Scholar
  15. 15.
    Kohavi, R.: Scaling up the accuracy of Naive-Bayes classifiers: a decision-tree hybrid. In: KDD, vol. 96, pp. 202–207(August 1996)Google Scholar
  16. 16.
    Gupte, A., Joshi, S., Gadgul, P., Kadam, A., Gupte, A.: Comparative study of classification algorithms used in sentiment analysis. Int. J. Comput. Sci. Inf. Technol. 5(5), 6261–6264 (2014)Google Scholar
  17. 17.
    Chen, T., He, T., Benesty, M.: Xgboost: extreme gradient boosting. R package version 0.4-2, pp. 1–4 (2015)Google Scholar
  18. 18.
    Kim, Y.: Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882 (2014)
  19. 19.
    Hochreiter, S., Schmidhuber, J.: Long short-term memory. Neural Comput. 9(8), 1735–1780 (1997)CrossRefGoogle Scholar
  20. 20.
    Principe, J.C., Euliano, N.R., Lefebvre, W.C.: Sky Software HelptoWord B. (Chap. 3). Multilayer Perceptrons. Available online at Accessed Nov 2018
  21. 21.
    Pennington, J., Socher, R., Manning, C.: Glove: Global vectors for word representation. In: Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1532–1543 (2014)Google Scholar

Copyright information

© Springer Nature Singapore Pte Ltd. 2020

Authors and Affiliations

  • Raj P. Mehta
    • 1
    Email author
  • Meet A. Sanghvi
    • 1
  • Darshin K. Shah
    • 1
  • Artika Singh
    • 1
  1. 1.Mukesh Patel School of Technology Management & EngineeringNMIMSMumbaiIndia

Personalised recommendations