Analyzing Public opinion on Climate Change via Twitter: A Machine Learning Approach Using Historical Data

Ahmad Salah, Mahmoud Mahdi, Mohamed Omar · Journal of Computing and Communication · 2025

Examining public perspective regarding critical issues such as climate change in the context of a vast social media stream necessitates a computational approach. This study provides an initial benchmark of five classical machine learning classifiers (Multinomial Naive Bayes, Logistic Regression, Linear Support Vector classifier (SVM), Random Forest, Gradient Boosting) on multi-class categorization (Anti, Neutral, Pro, News) using the openly available Twitter Climate Change Sentiment dataset (2015-2018). Models were built using Term Frequency-Inverse Document Frequency (TF-IDF) for feature representation and performance was assessed using standard metrics (Accuracy, F1-score), as well as modeling generalizability by comparing training versus testing performance to identify overfitting. Experimental results showed that Linear SVC achieved the highest test F1-score (~70.7) but exhibited significant overfitting (≈28%), while Logistic Regression provided the best compromise producing a competitive F1-score (~67.8) and a notably higher degree of generalizability (≈11.5% drop in F1). Gradient Boosting showed remarkable robustness with minimal overfitting (≈1.4% drop in F1) but had less absolute performance (~58.3% F1). This study provides an important baseline for this classification task and highlights the importance of generalization in evaluating model performance in addition to predictions for reliable stance analysis, particularly in computational social science.

Read the paper · More papers on PaperTik