Red Paper
International Journal of Computing and Artificial Intelligence

Impact Factor (RJIF): 5.57, P-ISSN: 2707-6571, E-ISSN: 2707-658X
Printed Journal   |   Refereed Journal   |   Peer Reviewed Journal
Peer Reviewed Journal

2025, Vol. 6, Issue 2, Part A

Sentiment analysis of social media data using multiple machine learning models: A case study on public opinion trends


Author(s): Mohammad Shihab Ahmed and Maha Safar Abdulmajed

Abstract:
Sentiment analysis is an important part of both data mining and natural language processing (NLP), which defines the extraction and analysis of public opinion from public discourse and social media, allowing researchers to understand community attitudes and perspectives during those moments in time, such as during a political election. The objective of this study was to perform an analysis of sentiment based on four machine learning models including: Naive Bayes, a feedforward neural network, Support Vector Machine (SVM) and Random Forest. Using a generated dataset of 10,000 tweets about a fictitious 2025 global political election, we performed the sentiment analysis using the four models mentioned, along with explanations of how this was done; including the data simulation, noise preprocessing, TF-IDF feature extraction, and training of the machine learning models using 5-fold cross validated modelling methods involving Python. Concerning the results: the accuracy of the models produced Naive Bayes at 83.1%, feedforward neural network at 81.2%, support vector machine at 83.1%, and random forest at 81.5%. The results of the analysis were supported with supportive measures of all metrics available i.e. precision, recall, F1-scores, confusion matrices, ROC curves, precision-recall curves and feature importance.
The sentiment distribution reveals a polarization: 45% positive tweets, 33% negative, and 22% neutral. Naive Bayes is very good for vast-domain analysis, whereas the neural networks promise capturing nuanced information given that computational optimization is achieved. SVM is consistent, while Random Forest is balanced in classification and could provide some information about features. There are eight visualizations integrated into the study framework as PNG images (e.g., confusion_matrices.png, wordcloud_positive.png): confusion matrices, ROC curves, precision-recall curves, word clouds, sentiment distribution, and feature importance, among others. This detailed and fully reproducible framework will support academic research and real-world applications to understand public opinion in the context of the 2025 election.



DOI: 10.33545/27076571.2025.v6.i2a.176

Pages: 37-59 | Views: 295 | Downloads: 136

Download Full Article: Click Here

International Journal of Computing and Artificial Intelligence
How to cite this article:
Mohammad Shihab Ahmed, Maha Safar Abdulmajed. Sentiment analysis of social media data using multiple machine learning models: A case study on public opinion trends. Int J Comput Artif Intell 2025;6(2):37-59. DOI: 10.33545/27076571.2025.v6.i2a.176
International Journal of Computing and Artificial Intelligence

International Journal of Computing and Artificial Intelligence

International Journal of Computing and Artificial Intelligence
Call for book chapter
Journals List Click Here Research Journals Research Journals