Convolutional Neural Network Model for Multi-Class Sentiment Analysis on Twitter with Deep Learning Approach
DOI:
https://doi.org/10.59934/jaiea.v5i1.1765Keywords:
Convolutional Neural Network, Deep Learning, Sentiment Analysis, TwitterAbstract
Social media, especially Twitter, has become an important space for people to express opinions, emotions, and views on various issues. Sentiment analysis on Twitter text is a relevant approach to understanding people's emotional tendencies. However, most previous studies still focus on binary classification, making it less able to describe expressions. This study aims to implement a Convolutional Neural Network (CNN) model in multi-class sentiment analysis on Twitter data using a deep learning approach. The dataset used was obtained from Hugging Face with 11,324 entries in the form of text (tweets) without sentiment labels. The research stages include text preprocessing, application of lexicons for initial labeling, construction of a CNN architecture using embedding layers, convolutional layers, global max pooling, and dense layers with softmax activation. The model was compiled using categorical crossentropy as a loss function and the Adam optimizer, then drilled and tested using training and test data. The results show that the CNN is able to achieve a total accuracy of 97% with high precision, recall, and f1-score in almost all emotion classes. In terms of efficiency, the model requires only 37.96 seconds of execution time and uses 0.106 GB of memory, making it lightweight and efficient. Thus, CNN has proven effective in performing multi-class sentiment analysis on Twitter and has the potential to serve as a benchmark in the development of deep learning-based public opinion analysis systems.
Downloads
References
A. Khaidar, M. Arhami, and M. Abdi, “Application of the Random Forest Method for UKT Classification at Politeknik Negeri Lhokseumawe,” Journal of Artificial Intelligence and Software Engineering, vol. 4, no. 2, pp. 94–103, 2024.
G. A. de Oliveira Júnior, R. de Oliveira Albuquerque, C. A. Borges de Andrade, R. T. de Sousa Jr, A. L. Sandoval Orozco, and L. J. García Villalba, “Anonymous Real-Time Analytics Monitoring Solution for Decision Making Supported by Sentiment Analysis,” Sensors, vol. 20, no. 16, p. 4557, Aug. 2020, doi: 10.3390/s20164557.
A. Vishwakarma and M. Chugh, “COVID-19 vaccination perception and outcome: society sentiment analysis on twitter data in India,” Social Network Analysis and Mining, vol. 13, no. 1, p. 84, May 2023, doi: 10.1007/s13278-023-01088-7.
S. Alghamdi and Y. Alhasawi, “Aspect-based sentiment analysis in smart devices: A comprehensive and specialized dataset,” Data in Brief, vol. 55, p. 110642, Jun. 2024, doi: 10.1016/j.dib.2024.110642.
Z. T. Osakwe, I. Ikhapoh, B. K. Arora, and O. M. Bubu, “Identifying public concerns and reactions during the COVID-19 pandemic on Twitter: A text-mining analysis,” Public Health Nursing, vol. 38, no. 2, pp. 145–151, Mar. 2021, doi: 10.1111/phn.12843.
Z. Li, F. Liu, W. Yang, S. Peng, and J. Zhou, “A survey of convolutional neural networks: analysis, applications, and prospects,” IEEE Transactions on Neural Networks and Learning Systems, vol. 33, no. 12, pp. 6999–7019, 2021.
A. TiaraSari and E. Haryatmi, “Penerapan Convolutional Neural Network Deep Learning dalam Pendeteksian Citra Biji Jagung Kering,” Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 5, no. 2, pp. 265–271, 2021.
B. Siswoyo and N. A. P. Utomo, “Pemanfaatan Machine Learning untuk Klasifikasi Sentimen Pelanggan pada Media Sosial,” Jurnal Teknologi Informasi Digital, vol. 1, no. 1, pp. 29–34, 2025.
I. W. Suasnawa and I. G. N. B. Caturbawa, “Penerapan Machine Learning untuk Analisis Sentimen di Media Sosial: Sebuah Tinjauan Literatur Sistematis,” Ganapati - Jurnal Rekayasa Teknik, vol. 3, no. 1, pp. 36–40, 2025.
S. D. W. Pratama, F. Panjaitan, M. I. Herdiansyah, S. D. Purnamasari, and N. A. O. Saputri, “Penerapan Metode Machine Learning Naive Bayes Pada Twitter Terhadap Sentimen Pada Pembelajaran Daring Di Indonesia,” JATI (Jurnal Mahasiswa Teknik Informatika), vol. 8, no. 6, pp. 11684–11688, 2024.
Z. Xi, F. Zhuang, G. Zhou, X. Cheng, F. Lin, and Q. He, “Domain Adaptation with Category Attention Network for Deep Sentiment Analysis,” arXiv preprint arXiv:2112.15290, Dec. 2021.
C. N. Dang, “Hybrid Deep Learning Models for Sentiment Analysis,” Complex & Intelligent Systems, vol. 7, pp. 1713–1723, 2021, doi: 10.1155/2021/9986920.
I. Priyadarshini, P. K. Sahu, R. Mallick, A. K. Sangaiah, and M. S. Hossain, “A novel LSTM–CNN–grid search-based deep neural network model for sentiment analysis,” IEEE Access, vol. 9, pp. 106907–106917, 2021, doi: 10.1109/ACCESS.2021.3099012.
A. Alhadlaq and A. Altheneyan, “A new hybrid deep learning approach for aspect-based sentiment analysis,” PeerJ Computer Science, vol. 10, p. e2267, 2024, doi: 10.7717/peerj-cs.2267.
Y. Chen, J. Fan, and D. Wang, “Local interpretation of deep learning models for Aspect-Based Sentiment Analysis,” Engineering Applications of Artificial Intelligence, vol. 132, p. 107612, 2024, doi: 10.1016/j.engappai.2024.107612.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Journal of Artificial Intelligence and Engineering Applications (JAIEA)

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.







