[Paper Review] Classification of Spam Emails through Hierarchical Clustering and Supervised Learning
This paper introduces SPEMC-11K, the first multi-class spam email dataset categorizing spam into Health and Technology, Personal Scams, and Sexual Content. Using hierarchical clustering on 12,500 English spam emails, the authors created a balanced dataset and evaluated TF-IDF and BOW encodings with SVM, Naive Bayes, and Logistic Regression, achieving a 95.39% micro-F1 score with TF-IDF + SVM and 2.13 ms per-email classification speed with TF-IDF + NB.
Spammers take advantage of email popularity to send indiscriminately unsolicited emails. Although researchers and organizations continuously develop anti-spam filters based on binary classification, spammers bypass them through new strategies, like word obfuscation or image-based spam. For the first time in literature, we propose to classify spam email in categories to improve the handle of already detected spam emails, instead of just using a binary model. First, we applied a hierarchical clustering algorithm to create SPEMC-$11$K (SPam EMail Classification), the first multi-class dataset, which contains three types of spam emails: Health and Technology, Personal Scams, and Sexual Content. Then, we used SPEMC-$11$K to evaluate the combination of TF-IDF and BOW encodings with Na\\"ive Bayes, Decision Trees and SVM classifiers. Finally, we recommend for the task of multi-class spam classification the use of (i) TF-IDF combined with SVM for the best micro F1 score performance, $95.39\\%$, and (ii) TD-IDF along with NB for the fastest spam classification, analyzing an email in $2.13$ms.
Motivation & Objective
- To address the limitations of binary spam classification by proposing a multi-class approach to improve spam handling and incident response.
- To create the first multi-class spam email dataset, SPEMC-11K, with three distinct spam categories: Health and Technology, Personal Scams, and Sexual Content.
- To evaluate the performance of text classification pipelines combining TF-IDF and BOW feature extraction with SVM, Naive Bayes, and Logistic Regression on the new dataset.
- To identify optimal trade-offs between accuracy and speed for real-time spam detection in cybersecurity applications.
Proposed method
- Applied hierarchical clustering to 12,500 English spam emails, filtering out those with fewer than five words, to form an unbalanced dataset of 11,462 emails.
- Conducted manual review and labeling of clusters to define three distinct spam categories: Health and Technology (62.61%), Personal Scams (32.31%), and Sexual Content (5.08%).
- Used TF-IDF and Bag-of-Words (BOW) as text feature extraction methods to represent email content numerically.
- Trained and evaluated six classification pipelines: TF-IDF and BOW combined with SVM, Naive Bayes, and Logistic Regression.
- Performed 5-fold cross-validation to assess performance using precision, recall, F1-score (micro, macro, weighted), and execution speed per email.
- Optimized hyperparameters using grid search, particularly for SVM and Logistic Regression, while using default settings for Naive Bayes.
Experimental results
Research questions
- RQ1Can hierarchical clustering effectively group spam emails into meaningful, manually verifiable categories for multi-class spam detection?
- RQ2How do TF-IDF and BOW feature representations compare in performance when combined with SVM, Naive Bayes, and Logistic Regression on a multi-class spam dataset?
- RQ3What is the trade-off between classification accuracy and execution speed in multi-class spam email pipelines?
- RQ4Can multi-class spam classification improve cybersecurity incident handling, early warning, and detection of targeted spam campaigns?
Key findings
- The TF-IDF + SVM pipeline achieved the highest micro-F1 score of 95.39%, indicating the best overall classification performance on the SPEMC-11K dataset.
- The TF-IDF + Naive Bayes pipeline was the fastest, processing each email in 2.13 ms, making it ideal for real-time spam filtering applications.
- TF-IDF consistently outperformed BOW across all classifiers, suggesting that term weighting improves multi-class spam detection.
- Naive Bayes pipelines had the lowest accuracy (87.68% with BOW, 92.94% with TF-IDF) but significantly faster inference times than SVM-based models.
- The TF-IDF + SVM model achieved 95.39% accuracy and F1-score in micro-averaging, demonstrating strong generalization on the multi-class task.
- The results suggest that concept drift may also affect multi-class spam detection, warranting further evaluation on time-series spam datasets.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.