From Traditional Machine Learning to Transformers: Sentiment Analysis on Social Media Data

Author: Patel Charmi D., Mevada Jayesh M., Patel Gaurang J., Patel Amit A.
Published Online: July 1, 2026
DOI: http://doi.org/10.63766/spujstmr.26.000070
Abstract
References

It is notoriously hard to analyze sentiment in social media. It is written in a disorganized manner, using slang, and is extremely dependent on implicit context. Classical baselines, including TF-IDF with Linear Support Vector Machines (SVM), however, give a good starting point. Nevertheless, such approaches do not capture the underlying semantic meaning as they deal with words individually. This paper compares traditional machine learning models with RoBERTa, transformer architecture with the ability to capture the entire sentence context. Social media detain the real world are sloppy, with too fine emotion tags and grossly skewed classes. In order to solve these problems, we designed a semantics-aware label consolidation algorithm based on Sentence Transformers. We then balanced our training data by using SMOTE in the continuous embedding space. Experiments with a multi-platform dataset with diverse data show that RoBERTa is significantly better than all classical baselines in terms of accuracy, precision, recall, and F1-score. More to the point, the transformer is able to deal with sarcasm and negation, which bag-of-words models often fail to do. This paper points to the need of contemporary sentiment analysis to include context-sensitive embedding and specific preprocessing to be able to read online communication correctly

Keywords: Machine learning, RoBERTa, sentiment analysis, social media,TF-IDF.
Download PDF Pages ( 26-34 ) Download Full Article (PDF)
←Previous Next →