Browse Source

Toutes les fonction sont opérationnel

master
philippot.m 1 week ago
parent
commit
38a39d6857
  1. 9
      k_plus_proche.py

9
k_plus_proche.py

@ -16,11 +16,12 @@ def kPlusProche(point,lst_representative):
voisins.sort() # Pour un couple, sort trie d'abord en fonction de la première valeur, donc la distance
return voisins
def PuissanceMoyenne(lst_trie):
def PuissanceMoyenne(lst_trie,k,lst_ref):
somme=0
if k > len(lst_tri):
if k > len(lst_trie):
k = len(lst_trie)
for i in range(0,k):
somme=somme+lst_ref(lst_trie[i](1))
somme=somme+lst_ref[lst_trie[i][1]][1]
return somme/k
lst_trie=kPlusProche((1,2,6),[(1,5,9,8),(9,6,2,8),(3,5,6,42)])
PuissanceMoyenne(lst_trie,1,[((1,5,9),8),((9,6,2),8),((3,5,6),42)])
Loading…
Cancel
Save