Social Media Text Sentiment Classification Based on Bag-of-Words Models with Multiple Machine Learning Algorithms
Siyuan Lee · 2024
In this paper, we use bag-of-words model combined with various machine learning algorithms to classify the sentiment of social media texts. Firstly, the data is classified into three categories of positive, neutral and negative according to the textual emotions, of which 47.81% are positive emotions, 31.28% are neutral emotions and 20.9% are negative emotions. Then, this paper establishes three sets of bag-of-words models based on the common adjectives of each textual emotion, transforms the text into a vector representation, and realises the conversion from text-based data to numerical data. Subsequently, algorithms such as logistic regression, Random Forest and support vector machine are used for training and the prediction accuracy of each model is evaluated. The results show that the Random Forest model performs best with an accuracy of 65%, followed by the logistic regression model at 63% and the Support Vector Machine model at 59%. The results highlight the superiority of Random Forest in social media text sentiment classification and provide an important reference for related research.