Research Article
Edge-Based Detection and Classification of Malicious Contents in Tor Darknet Using Machine Learning
Algorithm 4
KNN classification algorithm.
| Input: (), Web page to be predicted | | Output: the category of | | (1) | for to do | | (2) | Calculate the Euclidean distance between each sample in and | | (3) | | | (4) | end for | | (5) | = //Sort in ascending order | | (6) | sample minum //select samples that have the shortest distance | | (7) | set count //Count the number of each category in samples | | (8) | max //The category with the largest output number is the predicted category | | (9) | return |
|