Implementation of the K-Nearest Neighbors Algorithm for Spam Email Classification

Authors

  • Diani Putri Kusumaningrum Universitas Pelita Bangsa
  • Ahmad Turmudi Zy Universitas Pelita Bangsa
  • Suprapto Universitas Pelita Bangsa

DOI:

https://doi.org/10.36085/jsai.v8i1.7531

Abstract

In modern life, internet access has become essential for communication. Email is one of many communication tools. Cyberattacks such as ransomware, phishing, and cryptojacking continue to evolve and are difficult to detect by security systems as technology rapidly advances. Therefore, this study uses email spam as the subject of research. The aim of this study is to implement and calculate the accuracy of the K-Nearest Neighbors (KNN) algorithm in classifying spam emails with ham and spam labels. An accuracy of 85%, precision of 87%, recall of 93%, and F1-score of 90% were obtained from tests conducted with an 80% training data and 20% testing data ratio. The results show that the K-Nearest Neighbors algorithm can effectively classify spam emails.

Downloads

Published

2025-01-01

Issue

Section

Articles
Abstract viewed = 12 times