Email Spam Detection Using Logistic Regression and Explainable AI

Sumit Kanti Sarker, Ratul Bhattacharjee, Md Abu Sufian, Md Solaiman Ahamed, Md Abu Talha, Faiza Tasnim, K.M. Nazmul Islam, Sharia Tasnim Adrita · 2025

Email spam detection is crucial for ensuring a positive user experience and maintaining communication security. This study presents a novel spam detection approach leveraging Logistic Regression, optimized through hyperparameter tuning and enhanced with Explainable Artificial Intelligence. The proposed method is evaluated on a large-scale dataset of emails collected from a real-world spam detection system. Term Frequency-Inverse Document Frequency is utilized for feature extraction, converting email text into numerical representations. XAI introduces interpretability by highlighting critical features such as "pill," "PHP," and "Businessweek," which indicate spam classification patterns. Metrics such as precision, recall, and the confusion matrix are employed to assess the model’s performance, ensuring a balanced evaluation. Hyperparameter optimization using Grid Search CV achieves an optimal regularization parameter (C = 100) and maximum iterations (maxiter=100), resulting in an impressive F1 score of 98.76%, accuracy of 98.82%, precision of 98.62%, and recall of 98.90%.

Read the paper · More papers on PaperTik