Spam Email Detection Using Advanced Machine Learning Techniques
DOI:
https://doi.org/10.23755/rm.v56i0.1749Keywords:
Natural Language Processing (NLP), Transformer Model, Binary Classification, BERT (Bidirectional Encoder Representations from Transformers), SOM (Self Organising Maps).Abstract
The increasing sophistication of unsolicited and malicious email creates a need for spam-detection methods able to identify context-dependent and linguistically complex patterns that may evade conventional filters. This study compares two approaches to spam classification: Bidirectional Encoder Representations from Transformers (BERT) and Self-Organizing Maps (SOM). Generalization is assessed on five publicly available email benchmarks with different sizes and class distributions. For each dataset, thirty independent train-test partitions are generated; preprocessing, class balancing, model fitting, and REVAC hyperparameter tuning are performed using training data only. Performance on previously unseen test partitions is evaluated using precision, recall, accuracy, and F1-score. Both approaches provide effective classification, but BERT consistently outperforms SOM across all five datasets. The results support the value of contextual, sequence-aware representations for sophisticated spam patterns and underline the importance of rigorous, leakage-free evaluation when comparing spam-detection models.
Keywords: Natural Language Processing (NLP), Transformer Model, Binary Classification, BERT (Bidirectional Encoder Representations from Transformers), SOM (Self-Organizing Maps).
References
Y. Kontsewaya, E. Antonov, and A. Artamonov (2021). “Evaluating the Effectiveness of Machine Learning Methods for Spam Detection,” Procedia Computer Science, vol. 190, no. 2021, pp. 479–486, 2021, doi: https://doi.org/10.1016/j.procs.2021.06.056.
I. AbdulNabi and Q. Yaseen (2021). “Spam Email Detection Using Deep Learning Techniques,” Procedia Computer Science, vol. 184, no. 2021, pp. 853–858, doi: https://doi.org/10.1016/j.procs.2021.03.107.
J. Rajesh Kumar, G. Mahalakshmi, and P. Sudarshan (2020). “Email Spam Detection Using Machine Learning Techniques,” IARJSET, vol. 8, no. 6, pp. 189–193, Jun. 2020, doi: https://doi.org/10.17148/iarjset.2021.8632.
N. Ahmed, R. Amin, H. Aldabbas, D. Koundal, B. Alouffi, and T. Shah (2022). “Machine Learning Techniques for Spam Detection in Email and IoT Platforms: Analysis and Research Challenges,” Security and Communication Networks, vol. 2022, pp. 1–19, Feb. 2022, doi: https://doi.org/10.1155/2022/1862888.
G. Nasreen, M.M. Khan, M. Younus, B. Zafar, and M.K. Hanif (2024). “Email Spam Detection by Deep Learning Models Using Novel Feature Selection Technique and BERT,” Egyptian Informatics Journal, vol. 26, no. 2024, pp. 100473–100473, Jun. 2024, doi: https://doi.org/10.1016/j.eij.2024.100473.
Y. Guo, Z. Mustafaoglu, and D. Koundal (2023). “Spam Detection Using Bidirectional Transformers and Machine Learning Classifier Algorithms,” Journal of Computational and Cognitive Engineering, vol. 2, no. 1, pp. 5–9, doi: https://doi.org/10.47852/bonviewJCCE2202192.
A. Najam (2024). “Unlocking Spam with Transformers: Sentiment-Driven Detection via Fine-tuned BERT,” Medium, Feb. 13, 2024.
https://medium.com/@areeshanajam275/from-word-embedding-to-transformer-based-architecture-fine-tuning-bert-for-text-classification-of-80f87906d63c (accessed Nov. 17, 2024).
V. S. Tida and S. H. Hsu (2022). “Universal Spam Detection Using Transfer Learning of BERT Model,” in Proceedings of the Annual Hawaii International Conference on System Sciences, Hawaii: University of Hawaii at Mānoa Hamilton Library, pp. 7669–7677. doi: https://doi.org/10.24251/hicss.2022.921.
N.M. Gardazi, A. Daud, M.K Malik (2025). “BERT applications in natural language processing: a review”. Artif Intell Rev 58, 166. https://doi.org/10.1007/s10462-025-11162-5.
S.S.R. Subramanya Hemant Konduri, K. Netti (2024). “An Improved Email Spam Classification System Using Random Forest Classifier”. In: Choudrie, J., Mahalle, P.N., Perumal, T., Joshi, A. (eds) ICT for Intelligent Systems. ICTIS 2024. Lecture Notes in Networks and Systems, vol 1110. Springer, Singapore. https://doi.org/10.1007/978-981-97-6678-9_23.
N. Camatti, G. di Tollo, F., Gastaldi, F. Camerin (2025). “Cultural heritage reuse applying fuzzy expert knowledge and machine learning: Venice’s fortresses case study”. Regional Studies, Regional Science, 12(1), 225–251. https://doi.org/10.1080/21681376.2025.2472058
M. Corazza, G. di Tollo, G. Fasano, R. Pesenti (2021). “A novel hybrid PSO-based metaheuristic for costly portfolio selection problems”. Ann Oper Res 304, 109–137. https://doi.org/10.1007/s10479-021-04075-3
M. Licen, M. Astel, S. Tsakovski (2023). “Self-organizing map algorithm for assessing spatial and temporal patterns of pollutants in environmental compartments: A review”. Science of The Total Environment, Volume 878. https://doi.org/10.1016/j.scitotenv.2023.163084
G. di Tollo, S. Tanev, K.M. Slim, D. De March (2014). “Determining the Relationship Between Co-creation and Innovation by Neural Networks”. In: Faggini, M., Parziale, A. (eds) Complexity in Economics: Cutting Edge Research. New Economic Windows. Springer, Cham. https://doi.org/10.1007/978-3-319-05185-7_3
G. Sakkis, I. Androutsopoulos, G. Paliouras, V. Karkaletsis, C. Spyropoulos, P. Stamatopoulos (2001). “Stacking classifiers for anti-spam filtering of e-mail”. CoRR. cs.CL/0106040. 10.48550/arXiv.cs/0106040.
J.R. Méndez, F. Fdez-Riverola, F., Díaz, E.L. Iglesias, J.M. Corchado (2006). “A Comparative Performance Study of Feature Selection Methods for the Anti-spam Filtering Domain”. In: Perner, P. (eds) Advances in Data Mining. Applications in Medicine, Web Mining, Marketing, Image and Signal Mining. ICDM 2006. Lecture Notes in Computer Science(), vol 4065. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11790853_9
G.V. Cormack, T. R. Lynam. (2007). “Online supervised spam filter evaluation”. ACM Trans. Inf. Syst. 25, 3 (July 2007), 11–es. https://doi.org/10.1145/1247715.1247717
K.J. Gazal (2022). “Two-phase fuzzy feature-filter based hybrid model for spam classification”. Journal of King Saud University - Computer and Information Sciences, Volume 34, Issue 10, Part B, 2022, Pages 10339-10355, ISSN 1319-1578, https://doi.org/10.1016/j.jksuci.2022.10.025.
A. Attar, R.M. Rad, R.E. Atani (2013). “A survey of image spamming and filtering techniques”. Artif Intell Rev 40, 71–105. https://doi.org/10.1007/s10462-011-9280-4
N. Camatti, G. di Tollo, G., Filograsso, S. Ghilardi (2024). “Predicting Airbnb pricing: a comparative analysis of artificial intelligence and traditional approaches”. Comput Manag Sci 21, 30. https://doi.org/10.1007/s10287-024-00511-4
M. Honnibal, I. Montani (2017). “spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks, and incremental parsing”
T. Verdonck, B. Baesens, M. Óskarsdóttir et al. (2024). Special issue on feature engineering editorial. Mach Learn 113, 3917–3928. https://doi.org/10.1007/s10994-021-06042-2
N.V. Chawla, K. W. Bowyer, L. O. Hall, W.P. Kegelmeyer (2002). “SMOTE: synthetic minority over-sampling technique”. J. Artif. Int. Res. 16, 1 (January 2002), 321–357.
E.H. Tusher, M. A. Ismail, M. A. Rahman, A. H. Alenezi and M. Uddin (2024), "Email Spam: A Comprehensive Review of Optimize Detection Methods, Challenges, and Open Research Problems," in IEEE Access, vol. 12, pp. 143627-143657, , doi: 10.1109/ACCESS.2024.3467996
A. Bhowmick, S. Hazarika (2016). “Machine Learning for E-mail Spam Filtering: Review, Techniques and Trends”. 10.48550/arXiv.1606.01042.
Downloads
Published
Issue
Section
License
This journal provides immediate open access to its content on the principle that making research freely available to the public supports a greater global exchange of knowledge. The journal is committed to real and immediate open access for academic work. All of the journal articles are free to access immediately from the date of publication. There are no charge for readers to download articles and reviews for their own scholarly use. Benefits of open access for authors, include:
- Free access for all users worldwide
- Increased visibility and readership
- Rapid publication
- No spatial constraints
- Authors can share their research papers on their personal web-pages (i.e. ResearchGate, etc.)
Ratio Mathematica publishes open access articles under the terms of the Creative Commons Attribution (CC BY) License. The Creative Commons Attribution License (CC-BY) allows users to copy, distribute and transmit an article, adapt the article and make commercial use of the article. The CC BY license permits commercial and non-commercial re-use of an open access article, as long as the author is properly attributed. Copyright on any research article published by Ratio Mathematica is retained by the author(s). Authors grant Ratio Mathematica a license to publish the article and identify itself as the original publisher. Authors also grant any third party the right to use the article freely as long as its original authors, citation details and publisher are identified.
For further information visit: https://creativecommons.org/licenses/by/3.0/. The following logo will appear in any paper that will be published from the volume number 31/2016 onwards.