You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
706 B

from knn import kPlusProches
from lecture import lecture
6 months ago
def lancerTest(nombre_voisins, point_a_verifier, isEuclideanDistance):
"""effectue prédiction"""
fichier_apprentissage = lecture("data/pic-journalier-consommation.csv")
k_plus_proches = kPlusProches(point_a_verifier, \
fichier_apprentissage, \
6 months ago
nombre_voisins,\
isEuclideanDistance)
conso_prevue = 0
liste_indices = [elem[1] for elem in k_plus_proches]
for indice in liste_indices:
pic_conso = fichier_apprentissage[indice][1]
conso_prevue += pic_conso
return conso_prevue / len(k_plus_proches)