Research Article

Sentiment analysis based on machine learning models

Xinya Liao*
Nanjing University

* Corresponding author: [email protected]

Abstract

Sentiment analysis represents a pivotal research domain within the realm of natural language processing (NLP). Its significance lies in its capacity to scrutinize vast volumes of data originating from social networks and to offer invaluable insights. While numerous studies center on the exploration and enhancement of diverse models and techniques for sentiment analysis tasks, there is a scarcity of research dedicated to evaluating and contrasting the performance of these models. This paper undertakes an investigation to assess the efficacy of four distinct machine learning models: k-nearest neighbor (KNN), random forest, multinomial naive Bayes, and logistic regression, with the aim of shedding light on their relative effectiveness. The data in this research comes from two datasets, SST-2 and IMDB. Data from SST-2 is used for training and testing, and data from IMDB is used for further testing. The term frequency-inverse document frequency (TF-IDF) feature extraction method is integrated with the models and applied to the datasets. Results show that all the four models do well on SST-2 dataset, but KNN and random forest model perform poorly on IMDB dataset.

Keywords: Sentiment Analysis; Natural Language Processing; Machine Learning
Published: March 29, 2024
DOI: 10.54254/2755-2721/54/20241434
Volume: ACE Vol.54
pp. 129-134
Download PDF

References

  1. Zhao J Song M Gao X 2022 Research on Text Representation in Natural Language Processing (In Chinese) Journal of Software 33(01) 102-128
  2. Nandwani P Verma R 2021 A review on sentiment analysis and emotion detection from text Social Network Analysis and Mining 11(1) 81
  3. Elbagir S Yang J 2019 March Twitter sentiment analysis using natural language toolkit and VADER sentiment In Proceedings of the international multiconference of engineers and computer scientists Vol 122 p 16
  4. Wu Z 2023 Text Classification Based on Natural Language Processing and Machine Learning (In Chinese) Electronic Technology and Software Engineering216-219
  5. Zhang L Zhang B Kou H 2022 Tourist Landscape Perception of Jiangnan Ancient Town Based on Natural Language Processing of Network Comment Data (In Chinese) Journal of Chinese Urban Forestry 20(06) 125-132
  6. Sebastiani F Esuli A 2006 May Sentiwordnet: A publicly available lexical resource for opinion mining In Proceedings of the 5th international conference on language resources and evaluation pp 417-422 European Language Resources Association (ELRA) Genoa Italy
  7. Ye Q Zhang Z Law R 2009 Sentiment classification of online reviews to travel destinations by supervised machine learning approaches Expert systems with applications 36(3) 6527-6535
  8. Dang N C Moreno-GarcĂ­a M N & De la Prieta F 2020 Sentiment analysis based on deep learning: A comparative study Electronics 9(3) 483
  9. Nasukawa T Yi J 2003 October Sentiment analysis: Capturing favorability using natural language processing In Proceedings of the 2nd international conference on Knowledge capture pp 70-77
  10. He K 2021 Research and Application of Text Classification Based on Natural Language Processing (In Chinese) Nanjing University of Posts and Telecommunications
  11. Munikar M Shakya S Shrestha A 2019 November Fine-grained sentiment classification using BERT In 2019 Artificial Intelligence for Transforming Business and Society (AITB) Vol 1 pp 1-5 IEEE