Skip to main content
. 2023 May 9;8(2):197. doi: 10.3390/biomimetics8020197
Algorithm 3: K-means clustering
Input: K (the number of clusters); K = 2 (malicious or benign)
D dataset contains best feature values fbest,i for each URLi
Output: Cluster Sj
Begin
Arbitrary choose K objects from D as the initial cluster centers;
Repeat
  • -

    (re) assign each object to the cluster to which the object is the most similar, based on the mean value of the objects in the cluster;

  • -

    Update the cluster means, i.e., calculate the mean value of the objects for each cluster

Until no change;