Network intrusion detection based on improved KNN algorithm

Abstract In recent years, network attacks have occurred frequently, and Trojan horses, worms, and ransomware have emerged endlessly on the Internet. This poses a serious threat to cyber security and even national security. Therefore, a new three-branch decision soft increment K-nearest neighbor algo...

Full description

Saved in:
Bibliographic Details
Main Authors: Hongsheng Bao, Jie Gao
Format: Article
Language:English
Published: Nature Portfolio 2025-08-01
Series:Scientific Reports
Subjects:
Online Access:https://doi.org/10.1038/s41598-025-14199-2
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1849333347043508224
author Hongsheng Bao
Jie Gao
author_facet Hongsheng Bao
Jie Gao
author_sort Hongsheng Bao
collection DOAJ
description Abstract In recent years, network attacks have occurred frequently, and Trojan horses, worms, and ransomware have emerged endlessly on the Internet. This poses a serious threat to cyber security and even national security. Therefore, a new three-branch decision soft increment K-nearest neighbor algorithm is proposed, representing the class cluster as an interval set. The interval set’s upper, boundary, and lower bound correspond to the positive, boundary, and negative domains generated by the three-branch decision. An initial K-nearest neighbor algorithm based on representative points is proposed. The new datasets are pre-clustered in the same way to eliminate the influence of data processing order on the final clustering results. The results showed that the improved K-nearest algorithm could accurately classify Normal, Dos, and Probing, and the classification accuracy was above 85%. The accuracy of U2R was lower, with an average of 57.32%. The proposed method had the highest classification accuracy on the dataset, and the detection rate of all types of attacks reached more than 98%. This proposal is of great significance for the protection of network security.
format Article
id doaj-art-9079828383774ee094684e9519501ea2
institution Kabale University
issn 2045-2322
language English
publishDate 2025-08-01
publisher Nature Portfolio
record_format Article
series Scientific Reports
spelling doaj-art-9079828383774ee094684e9519501ea22025-08-20T03:45:53ZengNature PortfolioScientific Reports2045-23222025-08-0115111910.1038/s41598-025-14199-2Network intrusion detection based on improved KNN algorithmHongsheng Bao0Jie Gao1Internet of Things and Intelligent Engineering School, Jiangsu Vocational Institute of CommerceSchool of Digital Commerce, Jiangsu Vocational Institute of CommerceAbstract In recent years, network attacks have occurred frequently, and Trojan horses, worms, and ransomware have emerged endlessly on the Internet. This poses a serious threat to cyber security and even national security. Therefore, a new three-branch decision soft increment K-nearest neighbor algorithm is proposed, representing the class cluster as an interval set. The interval set’s upper, boundary, and lower bound correspond to the positive, boundary, and negative domains generated by the three-branch decision. An initial K-nearest neighbor algorithm based on representative points is proposed. The new datasets are pre-clustered in the same way to eliminate the influence of data processing order on the final clustering results. The results showed that the improved K-nearest algorithm could accurately classify Normal, Dos, and Probing, and the classification accuracy was above 85%. The accuracy of U2R was lower, with an average of 57.32%. The proposed method had the highest classification accuracy on the dataset, and the detection rate of all types of attacks reached more than 98%. This proposal is of great significance for the protection of network security.https://doi.org/10.1038/s41598-025-14199-2KNN algorithmNetwork intrusionThree branch decision-makingIncremental learningClassification
spellingShingle Hongsheng Bao
Jie Gao
Network intrusion detection based on improved KNN algorithm
Scientific Reports
KNN algorithm
Network intrusion
Three branch decision-making
Incremental learning
Classification
title Network intrusion detection based on improved KNN algorithm
title_full Network intrusion detection based on improved KNN algorithm
title_fullStr Network intrusion detection based on improved KNN algorithm
title_full_unstemmed Network intrusion detection based on improved KNN algorithm
title_short Network intrusion detection based on improved KNN algorithm
title_sort network intrusion detection based on improved knn algorithm
topic KNN algorithm
Network intrusion
Three branch decision-making
Incremental learning
Classification
url https://doi.org/10.1038/s41598-025-14199-2
work_keys_str_mv AT hongshengbao networkintrusiondetectionbasedonimprovedknnalgorithm
AT jiegao networkintrusiondetectionbasedonimprovedknnalgorithm