Implementation Latent Dirichlet allocation and RoBERTa for topic modelling and sentiment analysis of 2024 presidential election on social media X
Abstract
The presidential and vice-presidential elections are pivotal moments that reflect political dynamics and the aspirations of the people within the democratic process. The rapid growth of social media enables users to openly express their opinions, providing rich data for public opinion analysis. This study aims to analyze public sentiment and discourse surrounding each candidate pair during the 2024 Indonesian presidential election using Twitter (X) data. The dataset comprises 1,645,314 tweets collected between December 31, 2023, and January 31, 2024, with three main attributes: date, tweet, and label. Of these, 2,000 tweets were manually labeled for sentiment classification. Public opinion was measured in terms of candidate favorability, discussion of campaign programs, and emerging controversial narratives. This study integrates topic modeling using Latent Dirichlet Allocation (LDA) and sentiment analysis using the RoBERTa model. LDA identified five prominent topic categories—Debate, Campaign, Work Program, Supporters, and Political Conflict. These categories were derived through manual labeling and expert validation based on the top keywords and representative tweets in each topic. The “Political Conflict” topic includes discussions of controversies, disagreements, and misinformation involving candidate pairs. Sentiment classification using RoBERTa achieved the highest accuracy of 81.20%, outperforming traditional machine learning models such as SVM and logistic regression, as well as other deep learning models including BERT and DistilBERT.
Fields of Study & Subjects
Sentiment Analysis and Opinion Mining
Computational and Text Analysis Methods
Topic Modeling
Publication details
- Journal / source
- AIP conference proceedings
- Volume
- 3416
- Pages
- 040016–040016
- Publication date
- 1 January 2026
- Language
- EN