Spam Email Detection using K-Nearest Neighbors: An Enhanced Approach

Sumit Saklani, Kalyan Thapa, Devendra Pratap Singh · 2025

Spam emails represent a large portion of global email traffic and pose several risks, such as phishing, fraud, and malware attacks. Traditional spam filters are ineffective in combating spam that is ever-evolving, which makes the problems more complex in nature. Therefore, advanced machine learning techniques need to be adopted. This study attempts to integrate an optimized K-Nearest Neighbors (KNN) model for spam detection that implements Term Frequency-Inverse Document Frequency (TF-IDF) for text representation, along with Principal Component Analysis (PCA) for feature selection. Classification is performed with relevance to the neighbors with more distance using an adaptive distance weighting algorithm. Enhanced KNN techniques improve the metrics on Naive Bayes and Support Vector Machines (SVM) with respect to accuracy, precision, recall, and F1 score. Experimental results demonstrated the classification accuracy to amount 96.4 %, exceeds the existing systems. This study develops efficient spam detection systems having the capability of adapting novel spam methods.

Read the paper · More papers on PaperTik