Salelá algorithme K-nerest neighbors mpo na ko classer ba points ya ba données.
Pona kosalela algorithme K-nerest neighbors pona ko classer ba points de données, elingaki liboso to définir valeur pona 'K' pe lisusu kopesa point ya sika ya ba données oyo esengeli ko classifier na kotalaka proximité na yango na ba points de données 'K' ya pene . Ndakisa, tokanisa ete K ekokani na 3 mpe ete point ya sika ya ba données ezali [4, 3]. Etape ya liboso na algorithme ya K-nerest neighbors ezali ya kosala calcul ya distance entre point ya sika ya ba données na moko moko ya ba points ya ba données oyo ezali. Lolenge moko ya komeka ntaka oyo ezali kosalela formule ya Ntaka ya Euclidien, oyo elimbolami lokola misisa ya carré ya somme ya bokeseni ya carré kati na ba coordonnées moko moko ya ba points mibale. Na kosalelaka formule oyo, ba distances entre point ya sika ya ba données na moko moko ya ba points ya ba données oyo ezali ekoki kozwama boye : - [1,2] => sqrt((4-1)^2 + (3-2)^2) = sqrt (10) = 3,16 - [2,4] => sqrt ((4-2) ^ 2 + (3-4) ^ 2) = sqrt (5) = 2,23 - [2,3] => sqrt ( (4-2) ^ 2 + (3-3) ^ 2) = sqrt (4) = 2 - [3,5] => sqrt ((4-3) ^ 2 + (3-5) ^ 2) = sqrt (5) = 2,23 - [3,1] => sqrt ((4-3) ^ 2 + (3-1) ^ 2) = sqrt (5) = 2,23 - [5,5] => sqrt (( 4-5) ^ 2 + (3-5) ^ 2) = sqrt (5) = 2,23 - [5,3] => sqrt ((4-5) ^ 2 + (3-3) ^ 2) = sqrt (1) = 1 - [6,1] => sqrt ((4-6) ^ 2 + (3-1) ^ 2) = sqrt (8) = 2,82 - [6,2] => sqrt ((4.) -6) ^ 2 + (3-2) ^ 2) = sqrt (5) = 2,23 - [6,4] => sqrt ((4-6) ^ 2 + (3-4) ^ 2) = sqrt ( 5) = 2.23 Na kotalaka ba calculs oyo, ba