A Stacked Ensemble Classifier for Email Spam Detection via an Evolutionary Algorithm
Main Article Content
Abstract
Email communication is a crucial aspect of modern interactions. With the growing volume of spam emails, there is a pressing need for more effective antispam filters to detect unwanted messages. Existing spam detection techniques often fall short, prompting researchers to leverage machine learning and artificial intelligence to enhance online security. This study introduces an advanced spam detection technique using an ensemble learning approach. First, key features are extracted from both spam and non-spam emails via the term frequency-inverse document frequency (TF-IDF) method. Several classification algorithms, including cubist, naïve Bayes, support vector machine, rpart, and ctree, are applied to classify emails on the basis of the extracted features. A stacking model that uses an evolutionary algorithm is implemented to further increase the detection accuracy. The effectiveness of the proposed methodology is evaluated on widely adopted spam datasets. The results demonstrate its robustness, achieving an accuracy of 98.39% on the Enron dataset and 98% on the SpamAssassin dataset, highlighting its efficiency and significance in spam email detection.
Article Details
Issue
Section

This work is licensed under a Creative Commons Attribution 4.0 International License.
How to Cite
References
[1] L. Ceci, “Emails sent per day 2025,” Statista. Accessed: Sep. 29, 2024. [Online]. Available: https://www.statista.com/statistics/456500/daily-number-of-e-mails-worldwide/
[2] N. N. Nicholas and V. Nirmalrani, “An enhanced mechanism for detection of spam emails by deep learning technique with bio-inspired algorithm,” e-Prime - Advances in Electrical Engineering, Electronics and Energy, vol. 8, 2024, doi: 10.1016/j.prime.2024.100504.
[3] A. Petrosyan, “Spam e-mail traffic share 2023,” Statista. Accessed: Sep. 29, 2024. [Online]. Available: https://www.statista.com/statistics/420400/spam-email-traffic-share-annual/
[4] M. Raza, N. D. Jayasinghe, and M. M. A. Muslam, “A Comprehensive Review on Email Spam Classification using Machine Learning Algorithms,” in International Conference on Information Networking, 2021, pp. 327–332. doi: 10.1109/ICOIN50884.2021.9334020.
[5] K. Yusupov, M. R. Islam, I. Muminov, M. Sahlabadi, and K. Yim, “Comparative Analysis of Machine Learning and Deep Learning Models for Email Spam Classification Using TF-IDF and Word Embedding Techniques,” Lecture Notes on Data Engineering and Communications Technologies, vol. 231, pp. 114–122, 2025, doi: 10.1007/978-3-031-76452-3_11.
[6] L. Breiman, “Bagging predictors,” Mach Learn, vol. 24, no. 2, pp. 123–140, 1996, doi: 10.1007/bf00058655.
[7] D. H. Wolpert, “Stacked generalization,” Neural Networks, vol. 5, no. 2, pp. 241–259, Jan. 1992, doi: 10.1016/S0893-6080(05)80023-1.
[8] Y. Freund and R. E. Schapire, “A decision-theoretic generalization of on-line learning and an application to boosting,” in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), Springer Verlag, 1995, pp. 23–37. doi: 10.1007/3-540-59119-2_166.
[9] R. Meyes, M. Lu, C. W. de Puiseau, and T. Meisen, “Ablation Studies in Artificial Neural Networks,” Jan. 2019, Accessed: May 02, 2025. [Online]. Available: https://arxiv.org/pdf/1901.08644
[10] B. Przemyslaw, “DALEX: Explainers for complex predictive models in R,” Journal of Machine Learning Research, vol. 19, pp. 1–5, 2018, Accessed: May 25, 2025. [Online]. Available: http://www.jmlr.org/papers/v19/18-416.html
[11] G. Kumar and K. Kumar, “The Use of Artificial-Intelligence-Based Ensembles for Intrusion Detection: A Review,” Applied Computational Intelligence and Soft Computing, vol. 2012, pp. 1–20, 2012, doi: 10.1155/2012/850160.
[12] G. Folino and P. Sabatino, “Ensemble based collaborative and distributed intrusion detection systems: A survey,” 2016. doi: 10.1016/j.jnca.2016.03.011.
[13] S. Sen, “A Survey of Intrusion Detection Systems Using Evolutionary Computation,” in Bio-Inspired Computation in Telecommunications, 2015, pp. 73–94. doi: 10.1016/B978-0-12-801538-4.00004-5.
[14] H. Alyasiri, J. A. Clark, and D. Kudenko, “Evolutionary computation algorithms for detecting known and unknown attacks,” in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), Springer Verlag, 2019, pp. 170–184. doi: 10.1007/978-3-030-12942-2_14.
[15] S. Khanchi, M. I. Heywood, A. Vahdat, and A. Nur Zincir-Heywood, “On botnet detection with genetic programming under streaming data, label budgets and class imbalance,” in GECCO 2018 Companion - Proceedings of the 2018 Genetic and Evolutionary Computation Conference Companion, 2018, pp. 21–22. doi: 10.1145/3205651.3208206.
[16] T. A. Pham, Q. U. Nguyen, and X. H. Nguyen, “Phishing attacks detection using genetic programming,” in Advances in Intelligent Systems and Computing, Springer Verlag, 2014, pp. 185–195. doi: 10.1007/978-3-319-02821-7_18.
[17] H. Alyasiri, J. A. Clark, A. Malik, and R. De Frein, “Grammatical Evolution for Detecting Cyberattacks in Internet of Things Environments,” in Proceedings - International Conference on Computer Communications and Networks, ICCCN, Institute of Electrical and Electronics Engineers Inc., Jul. 2021. doi: 10.1109/ICCCN52240.2021.9522283.
[18] F. G. Abdulkadhim, Z. Yi, A. N. Onaizah, F. Rabee, and A. M. A. Al-Muqarm, “Optimizing the Roadside Unit Deployment Mechanism in VANET with Efficient Protocol to Prevent Data Loss,” Wirel Pers Commun, vol. 127, no. 1, pp. 815–843, Nov. 2022, doi: 10.1007/S11277-021-08410-6.
[19] B. Almusawy and A. A. H. Alrammahi, “Insider Detection Using Combination of Machine Learning and Expert Policies,” International Journal of Electrical and Electronic Engineering and Telecommunications, vol. 13, no. 5, pp. 389–396, 2024, doi: 10.18178/IJEETC.13.5.389-396.
[20] A. Orfila, J. M. Estevez-Tapiador, and A. Ribagorda, “Evolving high-speed, easy-to-understand network intrusion detection rules with genetic programming,” in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 2009, pp. 93–98. doi: 10.1007/978-3-642-01129-0_11.
[21] V. Sanh, L. Debut, J. Chaumond, and T. Wolf, “DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter,” Oct. 2019, Accessed: May 25, 2025. [Online]. Available: https://arxiv.org/pdf/1910.01108
[22] M. Akmal Afif Mohd Zuhdi, I. A. Rahmi Hamid, and F. Sains Komputer dan Teknologi Maklumat, “Classification of Spear Phishing Email using Machine Learning Approach,” Applied Information Technology And Computer Science, vol. 5, no. 1, pp. 34–51, Aug. 2024, doi: 10.30880/aitcs.2024.05.01.003.
[23] A. Junnarkar, S. Adhikari, J. Fagania, P. Chimurkar, and D. Karia, “E-mail spam classification via machine learning and natural language processing,” in Proceedings of the 3rd International Conference on Intelligent Communication Technologies and Virtual Mobile Networks, ICICV 2021, Institute of Electrical and Electronics Engineers Inc., Feb. 2021, pp. 693–699. doi: 10.1109/ICICV50876.2021.9388530.
[24] Samira. Douzi, F. A. AlShahwan, Mouad. Lemoudden, and Bouabid. El Ouahidi, “Hybrid Email Spam Detection Model Using Artificial Intelligence,” Int J Mach Learn Comput, vol. 10, no. 2, pp. 316–322, 2020, doi: 10.18178/ijmlc.2020.10.2.937.
[25] V. S. Tida and S. H. Hsu, “Universal Spam Detection using Transfer Learning of BERT Model,” in Proceedings of the 55th Hawaii International Conference on System Sciences, Hawaii International Conference on System Sciences, Jan. 2022. doi: 10.24251/hicss.2022.921.
[26] Y. Guo, Z. Mustafaoglu, and D. Koundal, “Spam Detection Using Bidirectional Transformers and Machine Learning Classifier Algorithms,” Journal of Computational and Cognitive Engineering, vol. 2, no. 1, pp. 5–9, 2023, doi: 10.47852/bonviewJCCE2202192.
[27] S. Zavrak and S. Yilmaz, “Email spam detection using hierarchical attention hybrid deep learning method,” Expert Syst Appl, vol. 233, 2023, doi: 10.1016/j.eswa.2023.120977.
[28] “The Enron-spam datasets.” Accessed: Sep. 29, 2024. [Online]. Available: https://www.cs.cmu.edu/~enron/
[29] “The Spam Assassin Email Classification Dataset.” Accessed: Sep. 29, 2024. [Online]. Available: https://www.kaggle.com/datasets/ganiyuolalekan/spam-assassin-email-classification-dataset
[30] S. Al-Augby and K. Nermend, “Using rule text mining based algorithm to support the stock market investment decision,” Transformations in Business and Economics, vol. 14, no. 3C, pp. 448–469, 2015.
[31] S. Kaddoura, G. Chandrasekaran, D. E. Popescu, and J. H. Duraisamy, “A systematic literature review on spam content detection and classification,” PeerJ Comput Sci, vol. 8, p. e830, Jan. 2022, doi: 10.7717/PEERJ-CS.830/TABLE-14.
[32] M. Parmar and A. Tiwari, “Enhancing Text Classification Performance using Stacking Ensemble Method with TF-IDF Feature Extraction,” in Proceedings - 2024 5th International Conference on Mobile Computing and Sustainable Informatics, ICMCSI 2024, 2024, pp. 166–174. doi: 10.1109/ICMCSI61536.2024.00031.
[33] D. Pakpahan, V. Siallagan, and S. Siregar, “Classification of E-Commerce Product Descriptions with The Tf-Idf and Svm Methods,” sinkron, vol. 8, no. 4, pp. 2130–2137, 2023, doi: 10.33395/sinkron.v8i4.12779.
[34] D. S. Ramdan, R. D. Apnena, and C. A. Sugianto, “Film Review Sentiment Analysis: Comparison of Logistic Regression and Support Vector Classification Performance Based on TF-IDF,” Journal of Applied Intelligent System, vol. 8, no. 3, pp. 341–352, 2023, doi: 10.33633/jais.v8i3.9090.
[35] M. Rajman and R. Besançon, “Text Mining: Natural Language techniques and Text Mining applications,” in Data Mining and Reverse Engineering, Springer US, 1998, pp. 50–64. doi: 10.1007/978-0-387-35300-5_3.
[36] M. Kuhn and K. Johnson, Applied predictive modeling. 2013. doi: 10.1007/978-1-4614-6849-3.
[37] M. Kuhn and S. Weston, “Package ‘Cubist’ R Package Version 0.4,” mirror.las.iastate.edu, 2024, Accessed: Oct. 20, 2024. [Online]. Available: https://mirror.las.iastate.edu/CRAN/web/packages/Cubist/Cubist.pdf
[38] R. M. Neal, “Pattern Recognition and Machine Learning,” Technometrics, vol. 49, no. 3, pp. 366–366, 2006, doi: 10.1198/tech.2007.s518.
[39] T. M. Therneau and E. J. Atkinson, “An introduction to recursive partitioning using the RPART routines,” 1997. Accessed: Oct. 06, 2024. [Online]. Available: http://stat.ethz.ch/R-manual/R-patched/library/rpart/doc/longintro.pdf
[40] T. Hothorn, K. Hornik, W. Wien, and A. Zeileis, “ctree: Conditional Inference Trees,” The Comprehensive R Archive Network;, no. Quinlan 1993, pp. 1–34, 2015, Accessed: Oct. 06, 2024. [Online]. Available: http://cran.irsn.fr/web/packages/partykit/vignettes/ctree.pdf
[41] T. Grubinger, A. Zeileis, and K. P. Pfeiffer, “Evtree: Evolutionary learning of globally optimal classification and regression trees in R,” J Stat Softw, vol. 61, no. 1, pp. 1–29, 2014, doi: 10.18637/jss.v061.i01.