diff --git a/kplusproche.py b/kplusproche.py new file mode 100644 index 0000000..de81df7 --- /dev/null +++ b/kplusproche.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +""" +Éditeur de Spyder + +Ceci est un script temporaire. +""" +def kPlusProches(k,donnees_point,temp_jour): + """erreur""" + voisins = [] + if k > len(temp_jour[0]): + k = len(temp_jour[0]) + energy = temp_jour.pop() + energy.sort + for i in range(len(temp_jour[0])): + d = distance(temp_jour[i],donnees_point) + voisins.append((d, i)) + voisins.sort() + return [voisins[i][1] for i in range(k)] +