Analyzing Sentiments in Twitter Data with a Support Vector Machine

Radhey Shyam, Isha Saxena, Mustafa Hussain · Research & Review Machine Learning and Cloud Computing · 2025

Analyzing public sentiments through various tweets, particularly on platforms like Twitter, has emerged as a valuable tool for measuring opinions on multiple topics, including politics, elections, government policies, and known figures. These tweets convey a wide range of sentiments, from supportive to critical viewpoints. In this study, the tweets are categorized into negative, neutral, and positive sentiments, represented by -1, 0, and 1, respectively. We harnessed a support vector machine, a robust supervised machine learning technique recognized for its efficacy in sentiment analysis tasks. Proposed methodology encompassed stages, such as data collection and pre-processing, which involved tasks like text cleaning, tokenisation, and TF-IDF vectorization. Subsequently, we trained the SVM model and evaluated its performance visually using bar charts, confusion matrices, and a classification report, capturing key metrics such as accuracy, precision, recall, and F1-score. This study underscores the significance of social media-driven political sentiment analysis and its relevance in understanding public opinion and political discourse. Furthermore, the results underscore the efficiency of SVM in analyzing tweet sentiments, achieving an accuracy rate of 94%, a weighted average rate F1-score of 94%, and recall rates of 87% for negative sentiment, 97% for neutral sentiment, and 95% for positive sentiment. The proposed strategy achieves classification accuracy up to 94% on the standard datasets (i.e., Kaggle).

Read the paper · More papers on PaperTik