Perbandingan Machine Learning dan Deep Learning untuk Klasifikasi Spam dengan Class Balancing
Main Article Content
Abstract
SPAM/HAM classification faces two primary challenges: class imbalance and the need to select a model that is both accurate and efficient. This study compares The Conventional Machine Learning Algorithm Naive Bayes and Support Vector Machine with Recurrent Deep Learning Algorithm Long Short-Term Memory, and Gated Recurrent Unit using a class-balancing strategy. The data underwent cleaning and deduplication before being split into a development set (80%) and a final test set (20%). Balancing was applied exclusively to the training set by downsampling HAM and oversampling SPAM to reach 1,500 samples each, while the validation and final test sets retained their natural distributions. NB and SVM utilized TF-IDF, whereas LSTM and GRU employed tokenization, 128-dimensional embeddings, and padding masks. NB achieved an accuracy of 98.63% and a Macro-F1 score of 96.65%, the highest among the four models. SVM yielded a PR-AUC of 97.55%; GRU achieved the highest SPAM recall at 94.96%; and LSTM attained the highest ROC-AUC at 98.92%. NB's training time was merely 0.004 seconds, compared to 6.61 seconds for GRU and 12.95 seconds for LSTM. The results demonstrate that traditional models remain competitive, offering a superior performance-efficiency trade-off for short-message data following class balancing.
Article Details

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
References
[2] U. Maqsood, S. Ur Rehman, T. Ali, K. Mahmood, T. Alsaedi, and M. Kundi, “An Intelligent Framework Based on Deep Learning for SMS and e-mail Spam Detection,” Applied Computational Intelligence and Soft Computing, vol. 2023, no. 1, p. 6648970, Jan. 2023, doi: https://doi.org/10.1155/2023/6648970.
[3] S. Zavrak and S. Yilmaz, “Email spam detection using hierarchical attention hybrid deep learning method,” Expert Syst. Appl., vol. 233, p. 120977, 2023, doi: https://doi.org/10.1016/j.eswa.2023.120977.
[4] P. Wanda, “GRUSpam: robust e-mail spam detection using gated recurrent unit (GRU) algorithm,” International Journal of Information Technology, vol. 15, no. 8, pp. 4315–4322, 2023, doi: 10.1007/s41870-023-01516-z.
[5] M. Kshirsagar, V. Rathi, and C. Ryan, “Meta-learner-based frameworks for interpretable email spam detection,” Front. Artif. Intell., vol. Volume 8-2025, 2025, doi: 10.3389/frai.2025.1569804.
[6] Y. P. Qiao, “Spam email classification based on SVM, Transformer and Naive Bayes,” Applied and Computational Engineering, 2024, [Online]. Available: https://api.semanticscholar.org/CorpusID:268585650
[7] M. Mujahid et al., “Data oversampling and imbalanced datasets: an investigation of performance for machine learning and feature engineering,” J. Big Data, vol. 11, no. 1, p. 87, 2024, doi: 10.1186/s40537-024-00943-4.
[8] N. Ramoji Rao and G. A. F. Vinodhini, “Measuring the efficiency of random forest, naive bayes, multilayer perceptron and support vector machine in email spam detection,” AIP Conf. Proc., vol. 3270, no. 1, p. 020052, Apr. 2025, doi: 10.1063/5.0262529.
[9] P. Charanarur, H. Jain, G. S. Rao, D. Samanta, S. S. Sengar, and C. T. Hewage, “Machine-Learning-Based Spam Mail Detector,” SN Comput. Sci., vol. 4, no. 6, p. 858, 2023, doi: 10.1007/s42979-023-02330-x.
[10] H. Amnur, “Customer Relationship Management and Machine Learning Technology for Identifying the Customer,” JOIV : Int. J. Inform. Visualization, vol. 1, no. 1, pp. 12–15, Mar. 2017, doi: 10.30630/joiv.1.1.10.
[11] P. Ghogare, H. Dawoodi, and M. Patil, Enhancing Spam Email Classification Using Effective Preprocessing Strategies and Optimal Machine Learning Algorithms. 2023. doi: 10.21203/rs.3.rs-3417942/v1.
[12] E. H. Tusher and M. A. Ismail, “FLSTM-ESD: A hybrid approach to fuzziness based long short-term memory network for email spam detection,” Advanced Engineering Informatics, vol. 73, p. 104597, 2026, doi: https://doi.org/10.1016/j.aei.2026.104597.
[13] G. Airlangga, “Spam Detection on YouTube Comments Using Advanced Machine Learning Models: A Comparative Study,” Brilliance: Research of Artificial Intelligence, vol. 4, no. 2, pp. 500–508, Oct. 2024, doi: 10.47709/brilliance.v4i2.4670.
[14] R. Arumugam S, A. Deborah S, R. S, M. R S, and M. T T, “SSN_ARMM at SemEval-2024 Task 10: Emotion Detection in Multilingual Code-Mixed Conversations using LinearSVC and TF-IDF,” in Proceedings of the 18th International Workshop on Semantic Evaluation (SemEval-2024), A. Kr. Ojha, A. S. Doğruöz, H. Tayyar Madabushi, G. Da San Martino, S. Rosenthal, and A. Rosá, Eds., Mexico City, Mexico: Association for Computational Linguistics, Jun. 2024, pp. 730–736. doi: 10.18653/v1/2024.semeval-1.105.
[15] R. Marriam, R. Mohamad, S. H. Moi, and H. Amnur, “A Comparative Study of Rumor Detection Domains: Machine Learning, Deep Learning, and Statistical Approaches,” JOIV : Int. J. Inform. Visualization
[16] Y. Yang, H. A. Khorshidi, and U. Aickelin, “A review on over-sampling techniques in classification of multi-class imbalanced datasets: insights for medical problems,” Front. Digit. Health, vol. Volume 6-2024, 2024, doi: 10.3389/fdgth.2024.1430245.
[17] F. Ares-Robledo, H. Rifà-Pous, and R. Clarisó, “Graph neural networks for anomaly detection: a systematic review of dynamic temporal approaches,” Artif. Intell. Rev., vol. 59, no. 5, p. 129, 2026, doi: 10.1007/s10462-026-11532-7.
[18] X. Wen and W. Li, “Time Series Prediction Based on LSTM-Attention-LSTM Model,” IEEE Access, vol. 11, pp. 48322–48331, 2023, doi: 10.1109/ACCESS.2023.3276628