Sentiment Analysis Using Stacking Ensemble After the 2024 Indonesian Election Results - Andy Victor Pakpahan; Fahmi Reza Ferdiansyah; Robby Gustian; Muhammad Nur Faiz; Sukma Aji (Politeknik Negeri Cilacap, 2025)
Sentiment analysis is a text processing technique aimed at identifying opinions and emotions within a sentence. Machine learning is commonly applied in this area, with algorithms such as Naïve Bayes, Support Vector Machine (SVM), and Random Forest being frequently used. However, achieving optimal accuracy remains a challenge, particularly when dealing with unstructured text data, such as content from social media platforms. This research seeks to improve sentiment analysis performance by implementing a stacking ensemble learning approach, which combines the predictive strengths of several base models. The base models selected for this study are Naïve Bayes, SVM, and Random Forest, while Random Forest also serves as the meta-model to generate final predictions. The study focuses on sentiment analysis in a specific context—public opinion following the announcement of the Indonesian presidential election results in 2024. The dataset comprises 6,737 tweets collected from the X platform using web scraping techniques in 2024. Results show that individual models achieved varying levels of accuracy: Naïve Bayes at 66.84%, SVM at 77.74%, and Random Forest at 74.78%. In contrast, the stacking ensemble model achieved a significantly higher accuracy of 81.53%. This improvement highlights the effectiveness of ensemble learning in integrating different algorithmic perspectives to enhance predictive performance. By leveraging the complementary strengths of each base model, stacking not only boosts accuracy but also increases model robustness, making it highly suitable for real-world sentiment analysis applications that involve noisy and informal textual data from social media.