|  |  | @ -11,16 +11,17 @@ def kPlusProche(point,lst_representative): | 
			
		
	
		
			
				
					|  |  |  |     Une liste triée en fonction de la distance dont les éléments sont des tuples (distance, indice du tableau original)""" | 
			
		
	
		
			
				
					|  |  |  |     voisins = []   | 
			
		
	
		
			
				
					|  |  |  |     for i in range(len(lst_representative)):  | 
			
		
	
		
			
				
					|  |  |  |         d = distance(point, lst_representative[i] ) | 
			
		
	
		
			
				
					|  |  |  |         d = distance (point, lst_representative[i] ) | 
			
		
	
		
			
				
					|  |  |  |         voisins.append((d, i)) | 
			
		
	
		
			
				
					|  |  |  |     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)]) |